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

Автор dimriXD, история, 7 лет назад, По-английски

Hello guys!

I am new to codeforces, I stumbled upon 230A problem and my code is here. My basic idea was to create a list of list containing three things first->strength of dragon, second->bonus points, third->flag if this dragon is killed or not. Then I sorted according to bonus points and started incrementing kills if a dragon could be killed based on condition.

Please help if there is a flaw in my logic or I missed something in the code. I shall be really thankful to you. Please help.

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

»
5 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Why we need sorting here please ?

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

We need to make a pair of vectors and then sort one of them. The other vector would be sorted accordingly. You can see my submission to the problem, it may help. Submission

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

I am failing test case #6:

2 2
3 5
1 2

"wrong answer 1st words differ — expected: 'YES', found: 'NO'"

Why the expected answer is YES when Kirito's initial strength is smaller that every dragon?

Thanks in advance!

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Kirito's initial strength is 2. This is larger that the second dragon's strength, which is 1. You might want to reread the input format.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

My 104218672 is falling in test case 9.

I think it should be YES, but the judge says that it is NO, can someone explain to me why is this NO?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    you should consider case in which dragon's strength is equal to kirito's strength.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    you are doing this s >= item.first, if i am not wrong, I checked your solution, but you have been told that the strength should be greater than the dragon and not greater than or equal to. So instead of s >= you will have to perform just s > item.first