Блог пользователя Lusterdawn

Автор Lusterdawn, история, 4 года назад, По-английски

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?

  • Проголосовать: нравится
  • +142
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 2   Проголосовать: нравится +98 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

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

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Atcoder has a button to download the testdata

»
4 года назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

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

»
4 года назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +19 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится +9 Проголосовать: не нравится

    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 года назад, # ^ |
      Проголосовать: нравится -18 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

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.