Features on my own auto-submitter for AtCoder

Updated:

This article is written for Competitive Programming Advent Calendar 2019.

What is “auto-submitter”?

When I participate in contests on AtCoder, I use my own auto-submitter to submit my solution automatically. It collects all samples in all problems in local and, before submitting my solution, it compiles my solution and test it with the samples.

Equivalent tools

If you want to use some auto-submitter, you try this. This is far better than mine.

Why did I develop by my own?

I regard myself as a programmer but not a software engineer. Generally speaking, it is better to use a great software developed by smart people than to develop my own. But I think that it was a good choice to make my own auto-submitter. Here I’d like to share with you why.

Preliminary

In this year, AtCoder has become a very popular playground. This was of course a good news for all AtCoder contestants. But the growth of participants caused a problem. To say briefly, the site was heavy during the contest. Perhaps you remember the disaster in May, 2019.

Fortunately, as you know, now the contest site is not heavy but comfortable, thanks to the investment for the database and the road balancer.

My aim

Let’s go back to the subject. The most important point I felt was the following statement.

確実にUnratedとなるのは、「問題が見れなくなった時」「提出が出来なくなった時」だけであり、採点の遅れでUnratedになることは多くありません。

Therefore, as long as we can see problems and submit our solutions anyway, the contest will be valid, except some special cases.

Of course, I can understand that this standard is fair and rightful. But, at least for me, this is hard to accept. When I participate in a contest, I concentrate all my effort to solving problems. I wonder how I would feel if the submission took a long time and I couldn’t see the next problem statement immediately.

I think that it is important to maintain my rights by myself. I have to guarantee that, as long as the submission page is alive, I can continue the contest without any worries. This was my aim to develop my own auto-submitter.

Features

I don’t want to open my source codes because it is very dirty. In addition, I don’t want to maintain my software for other environment; if I were to have such time, I would solve the past problems. But I want to share with you what I have implemented.

Basic functionalities

When the contest begins, my auto-submitter starts to fetch the samples and the time limit of each problems to my local.

When I finished writing a solution, All I have to do is just enter its file name. My auto-submitter recognizes which problem it is for and which language it is written in by its file name. Then it compiles the code and test all the samples.

  • If it passes all of them, it submits through the submission page automatically.
  • If it fails with some cases by WA or TLE, it informs me of the correct sample input and output.
    • Very basic point: if the result is TLE, it kills the process so that my CPU is not busy.
    • I can force it to submit the source code if I want.

I can add my own sample cases easily. And whether it succeeded or failed, it keeps all outputs in local in case I want to check them.

Run in background

My auto-submitter runs in background. All I should do during the contest is use my browser to see the problem statements, edit the solutions by my editor, and enter the file name in the terminal to submit it.

Easy to re-run

Even if I mistakenly kill the process of the auto-submitter, all I should do is re-run it. Every result is kept in my local file and whenever I enter valid manipulations, it takes note to its file. When I re-run auto-submitter, it loads the history from the file and I can continue the contest immediately.

If some sample should input and output is wrong and the admin announced it, all I should do is reload it to change my local. One command is suffice.

Capture the image of the problem statements

I said just before that first of all my auto-submitter collects all samples, but in addition, it also keeps the screenshots of the statements in image files. This is because, even if the contest site is very heavy, I can check the problem statements. It keeps both the screenshot and the HTML for each problems.

git commit automatically

Whenever I tries the solution in my local by the given samples, my auto-submitter does git add that file and makes git commit with a proper message. This is so cheap a solution that I cannot recommend to others. But the benefit is great. When I realize that I have erased good codes, I can restore it easily, without any additional duties. As long as I don’t push it to the remote during the contest period, it is legal.

Measure the time

My auto-submitter measures the time which I spend solving it for each problem. It also records the last submission time. So if the contest is a marathon type and it has time period like 5 min, I can set it before the contest. If I intend to submit within the set interval, the auto-submitter warns me not to submit and the left time.

Make the reviewing article automatically

I make it a rule to write the reviewing article for each contests. The template of my article is automatically put by my auto-submitter. If I skip reviewing my past contest, it appears as an empty article in this diary, which is embarrassing. You can find the empty articles in this diary, though. Thus it encourages me to review the past contest.

Conclusion

I love mathematics and programming. Thus I like to participate in contests for AtCoder. What I want to do is to work hard, that is, to concentrate my effort to thinking of problems. My auto-submitter benefits me very well.

In addition, I like the people involved in AtCoder. I want to be with you. Let’s continue to participate in programming contests. Thank you for reading!