SmartCoder's blog

By SmartCoder, 13 years ago, In English

this is my code HERE

i hacked with this test case "etr"
when i run this code in eclipse the answer is "YES"
but in CodeForces the answer is "NO"
what's the reason .
thanks
  • Vote: I like it
  • 0
  • Vote: I do not like it

13 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

Usually when I face this kind of prob, the most likely reason there is some uninitialized variable that you are using later. Uninitialized variable act differently depending on compiler.

13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
if (sz(ss) > 2 && ss.find(nounM, siz - 3) != -1) [line 72]
siz = sz(ss) - 1 [line 65]

So, if ss = "etr" then siz will be 2 and siz - 3 will be -1. Change line 65 to siz = sz(ss) and fix similar errors.
  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
     thanks david89 
    but why this difference between eclipse and other compilers ?


    • 13 years ago, # ^ |
      Rev. 4   Vote: I like it 0 Vote: I do not like it

      UPD: I was wrong again. But now I could debug this "solution" and hope to give exact answer in a few minutes.

      UPD more: I fear you need to specify what exactly compiler do you use with eclipse. I could not find out which compiler could ever give "yes" for "etr" testcase - and so I could not reproduce your question.
      • 13 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        I use mingw GCC
        please tell me what's the compiler you use to make local test like judge test 
        thanks :)