[PYTHON] Re: Competitive programming life starting from zero In order for beginners to get as high a performance as possible ~ ABC154 ~ 156 with impressions ~

Long time no see. I received ABC154,155,156 before posting for more than 2 weeks. 154 was solved up to C and the performance was 104, 155 was up to B 135, and 156 was up to C 354.

... It's pretty tough, but the performance has gradually improved.

And this time, I will write with a lot of prejudice how to improve the performance as much as possible by the technique of the baking blade, not the programming ability, which I felt after experiencing ABC a total of 3 times as a beginner of AtCoder.

The speed to finish solving the C problem is important

The battle has already begun before the contest begins! !! Depending on the difficulty level of that time, beginners often finish solving the C problem (probably), so the population is concentrated in that area. So if you solve this C problem early, the performance will improve. If you solve the C problem of ABC156 in 25 minutes, the performance is about 600, if you solve it in 40 minutes, it is about 350, and if it is the last minute, it is about 100.

By the way, if you solve it in 15 minutes, it will exceed 800. It is a so-called green performance. Lol

15 minutes is a pain, but even a beginner can theoretically become a tea coder as long as you can continue to solve up to C to some extent.

Then it's a story of how to solve it quickly. From the following, I will write a method like a baking blade for beginners like me to solve C problems quickly.

Put the input example in a variable and code test

This is very important. AtCoder will be penalized for 5 minutes if the code you submit is incorrect (this will significantly affect your ranking).

You who thought, "If you do a code test one by one, you will lose time"! !! I overestimate beginners.

Of course beginners are not accustomed to writing code, so there are many spelling mistakes and syntax mistakes. And the submitted code will be returned in RE and you will be penalized.

We strongly recommend that you code test the A problem properly. By the way, I submitted a lot at ABC154 and took a penalty of 45 minutes. Lol

Read the text of the input example carefully

Beginners don't know what they are saying by reading only the question sentences, especially from the C question. Lol However, if you read the text of the input example and then return to the question text, it may come to your mind easily.

It is recommended because it can be understood faster than reading the problem statement again.

Use copy

This is awesome. Lol But it is necessary to improve the performance even a little. Let's stain here with evil. Lol In particular, copying and pasting functions is recommended because it only rewrites the arguments at the time of output.

Then, when the contest is over, take a closer look at the contents of the copied code and study. ** Copy and paste is an advance borrowing of knowledge! !! ** **

I also copied and pasted a function that converts a decimal number to an n-ary number in ABC156, so I will study it. Lol

Draw a diagram in a notebook

In many cases, the C problem cannot be solved without a little mathematical inspiration. But this is a chance! !! You can submit it at explosive speed as long as you have an inspiration. https://atcoder.jp/contests/abc156/tasks/abc156_c Taking this ABC156 C problem as an example, the problem statement says that the minimum value is unpleasant, but in the end it is only necessary to find the midpoint of the coordinates, so if you can notice it, you can solve it in an instant.

Since what you do is the same as mathematics, it helps to inspire you by writing various figures in your notebook.


N = int(input())
X = list(map(int,input().split()))
P = sum(X)/len(X)
P = round(P)
count = 0
for i in range(N):
  count += (X[i] - P)**2
print(count)

The code is simple, so even beginners can write it immediately while searching. It's really just an inspiration.

Talking so proudly, I forgot that the point P is an integer value and took a penalty of 15 minutes ()

Finally

The above is how AtCoder beginners can get even a little higher performance with a baking blade, but the most important thing to say is ** "I'm going to lose my mistakes" **. That's all there is to it.

And since this article was written based on prejudice by me, who is a beginner in competition programming, please kindly point out if you did not intend to touch the scale of the competition progachi. (_ _) m

Recommended Posts

Re: Competitive programming life starting from zero In order for beginners to get as high a performance as possible ~ ABC154 ~ 156 with impressions ~
Re: Competitive Programming Life Starting from Zero Chapter 1.3 "Sedo Tea"
Re: Life in Heroku starting from scratch with Flask ~ PhantomJS to Heroku ~
Re: Competitive Programming Life Starting from Zero Chapter 1.2 "Python of Tears"
Re: Competitive programming life starting from zero Chapter 1 1 "Only C ++ can be used"
[For beginners of competitive pros] Three input methods to remember when starting competitive programming in Python
[For beginners] Re: Genetic algorithm starting from zero [Artificial intelligence]
Re: Life in Heroku starting from scratch with Flask ~ Selenium & PhantomJS & Beautifulsoup ~
Try to make a capture software with as high accuracy as possible with python (2)
[For beginners] Web scraping with Python "Access the URL in the page to get the contents"