aram90's blog

By aram90, 9 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

»
9 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.

»
9 years ago, # |
Rev. 4   Vote: I like it -21 Vote: I do not like it

it's better all input test case put on cloud(for example in box.com , 5G free and even 50G for android user...) and those link added to end of each test case , maybee it will be useful. :)

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

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

  • »
    »
    8 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 :)

  • »
    »
    8 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.

»
8 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.

»
8 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.

  • »
    »
    8 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)

    • »
      »
      »
      6 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.

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

Thank you so much! This helped a lot

»
12 months 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 ]

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

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

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

Is this thread still on ? I didn't quite get the idea. I want to see inputs for test case 2 but if I modify my code to only generate output for special cases than I'll fail test case 1 and will not be able to access the desired input/output for the test case 2.