Codeforces и Polygon могут быть недоступны в период с 23 мая, 7:00 (МСК) по 23 мая, 11:00 (МСК) в связи с проведением технических работ. ×

Блог пользователя Yubai

Автор Yubai, история, 2 года назад, По-английски

Given are Permutations of $$$(1,2,...N):p(p_1, p_2,...,p_N),q(q_1, q_2, ..., q_N)$$$

When you choose a number in the first permutation, the same position in the second permutation and the same value in the second permutation are both banned.

For example: $$$p:(1,3,2,4), q:(1,2,3,4)$$$

When you choose $$$p[2]=3$$$, you can't choose $$$q[2]$$$ which has the same position and also can't choose $$$q[3]=3$$$ which has the same value.

Find the ways of choose $$$i$$$ elements in the first permutation and left $$$j$$$ elements in the second permutation not banned, for every $$$i, j \leq N$$$

$$$N \leq 3000$$$.

  • Проголосовать: нравится
  • -36
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I know the way to solve it, it's amazing beautiful.