krish2004's blog

By krish2004, history, 5 months ago, In English

I cant understand why https://codeforces.net/contest/1987/submission/268352950 is not giving TLE but this is https://codeforces.net/contest/1987/submission/268340248. Both have same approach for the same question.

Tags tle, dp
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
5 months ago, # |
  Vote: I like it +3 Vote: I do not like it

you should pass the vectors inside the function via reference. ll DP(int i,int have,vll &cnt,vll &v1,ll n,vvll &dp)

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

Pass the vectors inside funcn by reference.