aram90's blog

By aram90, 12 years ago, In English

I have found a little trick recently that can help you to grab not big tests when solving tasks from problemset. A lot of people were complaining that when showing the test on which program gives a wrong answer, only some part of it is shown, so that complete test case couldn't be seen. If test case contains for example 100 lines, but system displays only first 20 lines of input, as well as 20 lines of the standard output of the program, then such strategy could be used: we add a check in the program — if the certain test case is given, it outputs lines 21 — 40 of the input file. In the next submission — output 41 — 60 lines, etc. So you can grab the input file part by part if it is not too big. Or if it is too big, you can just add the same check for certain input file, and use the output for debugging info (for example, output minimum from the numbers given, etc.). This method just helped me to find the bug in the program on which I got stuck about 3 hours.

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

| Write comment?
»
12 years ago, # |
  Vote: I like it +18 Vote: I do not like it

In my opinion, showing error output (may be only first 255 bytes) would be good idea. You can debug your program easily, like it works in TopCoder.

»
11 years ago, # |
  Vote: I like it -11 Vote: I do not like it

good idea for wa..but I Got TLE ... waht to do???

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Well, you'll only get a verdict "Time limit exceeded" in your submissions, system won't show you mistake in your code :)

  • »
    »
    11 years ago, # ^ |
    Rev. 5   Vote: I like it -8 Vote: I do not like it

    For example if your code gives a TLE verdict in this test case:

    5 2658
    13332 2223 312 2324 599
    13332 2223 312 2324 599
    .
    .
    .
    13332 2223 312 2324 599
    

    in your program you just write if (n == 5 && m == 2658) ... Just print from 1-20 lines of the input, and then from 21 — 40 and so on. But if there is another test case with same n and m, for examle this

    5 2658
    13332 2223 312 2324 499
    13332 2223 312 2324 599
    .
    .
    .
    13332 2223 312 2324 599
    

    You just have to find the difference between this two test cases (here it is a[0][4]) and if you need the first test case you write if (n == 5 && m == 2658 && a[0][4] == 599) if you need second you write if (n == 5 && m == 2658 && a[0][4] == 499). You just have to find the feature of needed test , which no other tests before it have.

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

I suggest you not to see the test case and instead of that review your code and see if there is any problem with that.it helps you to code better and with fewer bugs in the future.i think seeing the test case makes your mind lazy and it becomes a "trial and error" procedure.you have WA you see the test case you fix the bug.you have another WA you see the next test case and you fix another bug.while this be done faster if you review your code completely.good luck.

»
11 years ago, # |
  Vote: I like it +5 Vote: I do not like it

two problems:

1- if I want test 10 I need my program to pass first 9 test then do what you mentioned to test 10

2- when your program outputs wrong format the system will not show you your output.

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

    1) Mostly you'll need test 10 only if the verdict you have is Wrong answer on test 10, so your program is already correct for the first 9 tests.

    2) False: see 3196696 (you can see the output even though it is in wrong format)

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I know this is so old, but the result doesn't appear for me, gives wrong answer although my answer is right.

»
4 years ago, # |
  Vote: I like it -12 Vote: I do not like it

Hi for[ https://codeforces.com/problemset/problem/143/A ] what is the wrong here[ https://ideone.com/pk8VRQ ]

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

    Hey, why don't you just give us the submission link on Codeforces?

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

    You skipped the last newline.

    /* By the way, what is your point of using multiple accounts? I can guess your rated account. */ Sorry, I found some other probabilities. Now I'm not sure of that.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

If the test input is quite large then what should I do?