codeforces2k19's blog

By codeforces2k19, history, 5 months ago, In English,

Hi everyone, I am kind of new to Code forces but I have a doubt in regards of my submission to Problem 2A. Winner, the code always fail on test 10 returning a wrong answer.I am not able to resolve the problem.I think i am misinterpreting the problem....someone please explain the problem in detail especially this-> "if two or more players have the maximum number of points (say, it equals to m) at the end of the game, than wins the one of them who scored at least m points first"

Submission: 54014572 Submission: http://codeforces.com/contest/2/submission/54014572

Would appreciate any help I can get in regards of this issue ^^. Thanks in advance.

 
 
 
 
  • Vote: I like it
  • +5
  • Vote: I do not like it

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

Auto comment: topic has been updated by codeforces2k19 (previous revision, new revision, compare).

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

There can be negative points. If the input is:

3
a 2
b 2
a -1

Your program outputs a. But it should output b.

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

    Thanks for pointing out the mistake....it was really helpful.Thanks.

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

Your program does not consider cases when the overall result of a player would be worse than the current result. So the approach here is to calculate the final result of each player, then find the maximum and determine set of winners, and then iterate through the input data again to determine the player who scored max points first (and don`t forget to check if such a player is among possible winners).