Sexy_stack's blog

By Sexy_stack, 2 months ago, In English

vector<vector> mat(k + 1, vector(n + 1, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) { mat[j][i] = v[i][j]; } } // submission id https://mirror.codeforces.com/contest/2036/submission/289685104

this part give wrong answer when I use extra elements just to be safe from out of bounds but

vector<vector> mat(k + 1, vector(n + 1, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) { mat[j][i] = v[i][j]; } } this works perfectly . // submission id https://mirror.codeforces.com/contest/2036/submission/289685019

Please help me I am not able to get through it.

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

because there is extra $$$0$$$ at $$$k$$$'th index, the vectors are not sorted