Please read the new rule regarding the restriction on the use of AI tools. ×

pvcodes's blog

By pvcodes, history, 12 months ago, In English

Hello peeps! So I all started when solving a C problem, I got the logic but for some TCs it was failing and I wasn't able to see those TCs. So I searched a bit on the web "How to get the testcases of any problem CF?" but found out there are no simple ways to get them. From there I got the idea to make something that turned down to this CF-TESTCASES using some web scrapping technique and CF's own API.

[TL/DR] I wasn't able to get the TCs of the problems. So this CF-TESTCASES gets the job done!!

REPO LINK

Have a look at it and give your valuable feedback!!

Happy Coding!!

PEACE OUT!

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

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

How do u run the py file in pycharm, sorry i am dumb!!!. i just copied the code and tried to run it it showing errors in the code

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

So this does give the testcases even for large cases (I was too lazy to try it on my own)? Because normally you cant see them. If so you did a great job and this is the best thing ever

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

    That's something I've not tried till now, but I'm pretty confident that it would work just fine. And if still, it fails please raise an issue on the repo with relevant info. We'll look into it.

    If you are talking about hidden test cases, then yes they'll will be fetched 100%

    At first, I thought you were talking about large testcases which are over an away in a number of testcases

    • »
      »
      »
      12 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I just tried out your program and fetched test cases for 2 problems. However, for large test cases, it is not showing all of them. I hope you look into this issue.

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

        Can you please share the problem and how many TCs it fetched.

        • »
          »
          »
          »
          »
          12 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I tried to fetch the test cases for problem 1879-A. It successfully retrieved 7 test cases. However, when I try to view the numbers of the 1st test case, after a certain point, it displays three dots (...)

          • »
            »
            »
            »
            »
            »
            12 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            yeah!!, it turns out CF does not give all TCs in any way possible, they just truncate the TCs with three dots, after a certain length.

            I'll be doing some workaround like not getting all TCs but getting TCs that are fully useful!

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

      I haven't installed the tool, but I may know what the problem is. From skimming your code, it looks like your tool goes to the webpage of an AC submission and downloads the test cases from the corresponding text boxes. However, this does not work for test cases over a certain size. Consider test case 4 at this link, for example: after printing a certain number of characters, the input is truncated.

      My understanding is that Codeforces does not make full test cases available to reduce problem theft.

      • »
        »
        »
        »
        12 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Certainly, they don't make all TCs available. I've gone through their response sheet for particular problems' TCs, from the backend only they put three dots after a particular length.

»
12 months ago, # |
  Vote: I like it +1 Vote: I do not like it

It seems that this tool has been having some problems fetching very large test cases due to Codeforces truncating tests. A really slow solution (that may be against Codeforces rules) would be to implement a hacky way of getting test cases. Since the program output is included in the submissions page, you could, in theory, submit code that prints out the first 50 lines of input, then the next 50, and so on. This would require significantly more work to implement, but it could likely be done (albeit, very slowly).

»
12 months ago, # |
  Vote: I like it +11 Vote: I do not like it

(I assume) The tool fetches the submission HTML page and then extracts the embedded test case. As the response page truncates the test input but only show first N characters of each test, I don't see how magically the tool works around it and likely it does not. To get test input with O(1000) numbers, people can throw exception in the code to show a chunk of such numbers and do it in O(20) submissions, which is rather tedious and not feasible for larger input.

The real solution would be for CF to provide a download link for compressed test inputs. Maybe the concern was additional network traffic and server load. It will be a nice feature to have.

  • »
    »
    12 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    So, it turns out from their backend only they don't send full TCs

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

This is pretty cool TBH, but I kinda like the fact that we can't really see the testcases. I think that's intended, you know

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

Did You find any way out for this. I am also facing the issue of ... after certain length