Aggu_01000101's blog

By Aggu_01000101, history, 4 years ago, In English

Do you guys keep getting this error? It's quite irritating, I have to login around 5-6 times to get into the website.

Any fix?

Full text and comments »

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

By Aggu_01000101, history, 5 years ago, In English

Hey,

I was recently trying to download all of my CodeForces submissions into a folder on my Mac.

I found various scripts that would do the job, but the only complete application was this one.

Unfortunately, I noticed an error while using it. I have 400+ AC submissions but it was only downloading 70.

After inspecting the code thoroughly, I have come to the following conclusion:

There are two main issues with this program:

  1. It can't download Gym submissions since that requires the user to be logged in.

  2. It has trouble identifying which submissions are gym submissions. This wouldn't be a problem ordinarily, expect for the fact that this leads to a large amount of blank files being created with no content.

There was also a small exception due to problems like this, which have no 'problem ID' (ABCDEFG). This was easily fixed with some try-catch blocks.

Coming back to the main issues:

  1. I see no fix to this unless JSoup can somehow remain logged in to your CodeForces account while performing the queries. This is one of my first times trying something like this so I'd encourage Java users to post their thoughts on this in the comments.

  2. This is slightly more complicated.

Since this program was written roughly 5 years ago, the author just considered any problem to be a gym problem if the contest ID had length > 3. This was fine when the total number of CodeForces contests was < 1000. However, this is no longer the case.

I tried changing this to > 4 but I had no luck. Unfortunately, there are already gym contests with 4 digit codes so there is no way to distinguish between Gym contests and Official contests via the contestId.

My next idea was slightly ridiculous. I tried to write a function which would return true or false depending on whether the given problem was a gym problem. The function checked for this by loading the submission url. If the url had the code we needed, it had to be a regular problem. If it didn't, it must be a gym problem. However, after running through ~250 problems, CodeForces gave a "too many requests" error and didn't let me load any more submission URLs.

Does anyone have a fix for this?

Would it be possible to add a ContestType tag or something along those lines to the submission object?

Thanks.

Full text and comments »

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