Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Error on vector initialization

Revision en3, by Legend_11, 2024-04-05 17:17:35

Hello Codeforces, I came across an interesting error while solving this problem : https://codeforces.com/contest/1950/problem/G which I am not able to understand as to why this is happening?

https://codeforces.com/contest/1950/submission/255101098 (This solution did not get accepted but gave runtime error) https://codeforces.com/contest/1950/submission/255101528 (This solution got accepted)

Note there is very little difference between the two

In the first solution I have initialized vector as : vector<vector<int>>dp(n,vector<int>((1<<n),-1));

In the second solution I have initialized vector as : vector<vector<int>>dp((1<<n),vector<int>(n,-1));

I really don't understand what is causing this error. Any help would be appreciated. Thank you !

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Legend_11 2024-04-05 17:17:35 6 Tiny change: 'ion/255101766 (This sol' -> 'ion/255101098 (This sol'
en2 English Legend_11 2024-04-05 16:32:55 80
en1 English Legend_11 2024-04-05 16:30:46 723 Initial revision (published)