Vector vs Array

Revision en1, by iamujj15, 2022-10-02 14:54:19

In the AtCoder Beginner Contest 271, I made two submissions for Problem D.

Submission 1, which is an AC.

Submission 2, which is a WA.

In Submission 1, I declared dp as int dp[101][10001]; globally, and used memset(dp, -1, sizeof(dp)); inside main function. In Submission 2, I declared dp as vector<vector<int>> dp(101, vector<int>(10001, -1)); inside main function, and passed it in function 'f' by reference.

I'm clueless about what is causing this WA in Submission 2, when the logic remains same. Could someone please help me with this.

Tags dp, vector, array, c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English iamujj15 2022-10-02 14:54:19 744 Initial revision (published)