triton21's blog

By triton21, history, 8 years ago, In English

I am a leaner and just now trying to solve problem 230 A . i got rte and i thought my array wasnt big enough but it wasnt the case . can someone help me find the bug ? or MLE is included as rte in codeforce ??

my code is in this link : http://ideone.com/82YKlw

the problem link : http://codeforces.com/problemset/problem/230/A

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

»
8 years ago, # |
  Vote: I like it +6 Vote: I do not like it

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

»
8 years ago, # |
  Vote: I like it +7 Vote: I do not like it

There is your problem in your cmp.
Code

  • »
    »
    8 years ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    wow thx alot . but mind asking why my previous cmp function can cause rte ?

    • »
      »
      »
      8 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it
      When you wrote :
      
          if (a.f < b.f) {
              return true;
          }
          return a.s > b.s;
      If a.f > b.f your code return a.s > b.s. It's uncorrect. You need return false.
      
      • »
        »
        »
        »
        8 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        i see thx for the help i really appreciate it