Lusterdawn's blog

By Lusterdawn, history, 4 years ago, In English

When my solution fails on a larger testcase, I can only see the first few lines of the testcase and have to submit again and again to find out what's going wrong with my code. I think it would be much easier to debug if I can download the testdata. In this way I can test my solution locally.

I'm not sure if here is the right place to ask, but is there any way to download the testdata of the problems?

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

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it +98 Vote: I do not like it

Idk why this has so many down votes. It's a good question, a feature that would be super nice, and you have an undertale-themed name; what's not to like?

The short answer is: no, unfortunately there isn't. Or not to my knowledge at least.

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

    Thank you for your reply. I know it is available in many other OJs and I thought it's also true for codeforces =(

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

Atcoder has a button to download the testdata

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

Commenting for better reach since this is a much needed question. Hope you get what you were looking for.

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

Hey! There is one method but sometimes it's very tedious.
Analyze the test case. And find some things that are not in the previous test cases.

Example

Sometimes it happens that there are many tests in one test case. In that case, you can check for the test case number and print the input.

Example
»
4 years ago, # |
  Vote: I like it +9 Vote: I do not like it

No, but there should be. I really cannot think of a reason to justify making a test case data partially accessible. When it is not hidden, it should be completely visible.

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

    I can: if you have the complete test data, it's easy to steal problems: writing a checker is usually trivial.

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

well downloading the big test cases is like making a big test case, because if you download it, how do you want to debug it!? so if you want to find a test case and debug your solution, you can write another program which you are completely sure that is working (even if its complexity is too bad) then make a big test case(you can use random) and then check your solution with the other one. then you can find a smaller test which your program is giving WA. it works most of the time.

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

    Normally this is what I do, but sometimes it is hard to generate strong tests. If I can download the testcase I can test my solution easily instead of submitting over and over again, waiting for the verdict

  • »
    »
    3 years ago, # ^ |
      Vote: I like it -18 Vote: I do not like it

    It is appalling that many high-rated coders don't know how to debug a program on a large test case.

    Hint: debugging has nothing to do with "Debug" button in your IDE.

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

Having a feature like CSES would be nice. You can press the eye and the whole test would pop up.

»
3 years ago, # |
  Vote: I like it +16 Vote: I do not like it

It would be very useful to have this feature.

Although some people say it's impossible to debug the program with an array of N=10,000 elements, I still find it useful, and I can provide an example.

Recently, I have struggled with the problem which assumes a lot of if-branches in the solution. The structure of my solution was like this:

if (...)
    return "NO"
if (...)
    return "NO"
if (...)
    return "NO"
return "YES"

When I checked out my submission status, I could see that my program returned NO when there should be YES.

Of course, I wouldn't analyze the entire test case of size 10,000, but at least I could find out what branch led to NO answer.

To that end, I had to manually extract the test case. I did 20 submissions in order to print the input data and concatenate it afterwards.

Once I merged everything, I was able to run the test and find out the wrong branch. It was extremely helpful.

I wish codeforces had an opportunity to download tests in order to avoid "manual extraction and concatenation" of test data through 20+ submissions.