Please read the new rule regarding the restriction on the use of AI tools. ×
Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

krish2004's blog

By krish2004, history, 3 months ago, In English

I cant understand why https://codeforces.me/contest/1987/submission/268352950 is not giving TLE but this is https://codeforces.me/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

»
3 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)

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

Pass the vectors inside funcn by reference.