Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Error on vector initialization

Правка en1, от Legend_11, 2024-04-05 16:30:46

Hello Codeforces, I came across an interesting error which I am not able to understand as to why this is happening?

https://codeforces.net/contest/1950/submission/255101766 (This solution did not get accepted but gave runtime error) https://codeforces.net/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 !

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Legend_11 2024-04-05 17:17:35 6 Tiny change: 'ion/255101766 (This sol' -> 'ion/255101098 (This sol'
en2 Английский Legend_11 2024-04-05 16:32:55 80
en1 Английский Legend_11 2024-04-05 16:30:46 723 Initial revision (published)