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

Автор Jahid, история, 7 лет назад, По-английски

In Codeforces Round 433 Div 2, I have seen a solution of problem E.

Since, the value of n was 200000. So it was not possible to solve the problem by declaring a n*n(200000*200000) array.

But, In that solution a solver has used a vector efficiently instead of two dimensional array. I have tried but couldn't got this.

Can anyone please help me on this?

Thanks in advance.

Problem : http://mirror.codeforces.com/contest/854/problem/E

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

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

Which solution were you looking at?

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

You have only one square per row and only one square per column, for a total of N squares, so you only need to store N values, you don't need 2D.