isitcorrect's blog

By isitcorrect, history, 12 months ago, In English

in problem https://codeforces.me/contest/1579/problem/D

my previous solution has core implementation https://codeforces.me/contest/1579/submission/338348122 in this i was taking two biggest numbers a,b and saving them min(a,b)*times in answer vector but it gave wrong answer on 2nd test case

this gets accepted https://codeforces.me/contest/1579/submission/338349269

but when i checked the other solution they were simulating one by one pairs i didn't get what difference will it create when taking all simultenously or taking one by one why take one by one here

please help!!!

  • Vote: I like it
  • -11
  • Vote: I do not like it

»
12 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Here is a test case where your approach gets the wrong answer:

1
3
3 3 2

Your code outputs 3 talks, but it is possible to get 4 talks.

4 
2 1
3 2
1 3
2 1

Try running through the incorrect code yourself to see why this happens.

Hope this helps!