Блог пользователя isitcorrect

Автор isitcorrect, история, 12 месяцев назад, По-английски

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!!!

  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится

»
12 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

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!