[PYTHON] When I tried the AtCoder Beginner Contest, it was a terrible result, so I look back

When I participated in the AtCoder Beginner Contest, which is held regularly, I stumbled in a place other than pure lack of ability and did a lot of waste, so to deepen my next learning Make a note of what you can do.

Participated in "ABC 170" https://atcoder.jp/contests/abc170

Input is "standard input" instead of command line arguments

Yes.

A problem, I was writing code to get input from sys.args. Naturally it is moss, but I melted it for 20 minutes with the power of my belief. It was the most meaningless time.

Input value is captured by ʻinput`.

#mistake
import sys

args = sys.argv

# do something ...
#Correct answer.The following is when the input is two integer values
x, y = [ int(i) for i input().split() ]

# do something ...

If you get stuck with WA (Wrong Answer) or RE (Runtime Error), try writing a simple test case

It's a bit of a hurdle to generate all the cases that can consider all the conditions nicely (probably not clogged if you can consider it), so I'll write at least the code for generating test data that can be run locally. I will.

Fortunately, the input value conditions are explicit, so you'll be able to write a little code to generate the test data right away. I think that if you pass it to the answer code over the pipe, the verification will be a little better.

If you let strerr spit out the generated data on the test case generation side, it will not interfere with the input of the answer code while checking the input value, so for the time being, I will try this when the WA gets stuck next time.

Looking back on the problem that ended as WA

During the contest, the details of the cause of the test failure will not be given, so if there is a problem that ended by trial and error as WA, I will look back on it.

When I'm addicted, I don't really know what's wrong, so I'm worried if I don't check properly whether it's due to a lack of consideration related to logic or algorithms such as boundary conditions, or simply due to my own careless mistake. I can not sleep.

Test cases of past questions are posted in the "Convenient Links" below. It is possible to drop data from there and verify the case that was actually WA.

https://atcoder.jp/posts/261

AtCoder's Testcases This is a test case of AtCoder's past questions. It can be used for review etc. It does not support very old contests.

By observing each test case, you can see the way of thinking such as boundary conditions, which may be useful for the development work of test cases of actual projects.

I would also like to confirm the answers and official commentary of other participants. I would like to follow up on the problems that I struggled with because I could not see the solution.

from next time

At this point, we don't plan to give priority enough to commit to Procon.

However, I will continue to participate in ABC. I will look back only on the care of the problem that ended in the middle of the answer and will come next time. If you repeat it, the day will come when you can do this retrospective work with a tough problem in the second half. maybe.

Recommended Posts

When I tried the AtCoder Beginner Contest, it was a terrible result, so I look back
In IPython, when I tried to see the value, it was a generator, so I came up with it when I was frustrated.
AtCoder Beginner Contest 177 Problem C I tried to find out why it was wrong
When I tried to run Python, it was skipped to the Microsoft Store
[Professional competition practice] I tried AtCoder Beginner Contest 171
A story that was convenient when I tried using the python ip address module
I tried to make the phone ring when it was posted at the IoT post
A Python beginner made a chat bot, so I tried to summarize how to make it.
A beginner tried coloring line art with chainer. I was able to do it.
It's been a year since I was self-taught and moved to the web application development department, so I look back
[Professional competition] I tried At Coder Beginner Contest 175 (A ~ C)
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.
I stumbled when I tried to install Basemap, so a memorandum
There was a doppelganger, so I tried to distinguish it with artificial intelligence (laughs) (Part 1)
When I tried to scrape using requests in python, I was addicted to SSLError, so a workaround memo
A memorandum when I tried to get it automatically with selenium
When a Python beginner tried using Bottle, it worked unexpectedly easily.
I came across an image filter with a clearly Japanese name called Kuwahara filter, and when I tried it, it was amazing, so I will introduce it.
I wondered if it became so easy when it became centos8 2 ~ I tried adding PHP ~
I tried to make a calculator with Tkinter so I will write it
I tried to verify the result of A / B test by chi-square test
Github Interesting Repository ① ~ I found a graphic repository that looks interesting, so I tried it ~
When I try to go back using chainer, it fits a little
The tree.plot_tree of scikit-learn was very easy and convenient, so I tried to summarize how to use it easily.
When I made a treemap (area graph) with python, it was subtle, so when I used flourish, it felt pretty good.
I tried using pipenv, so a memo
I wanted to know the number of lines in multiple files, so I tried to get it with a command
When I investigated whether the COTOHA API could understand comics, it was reasonable.
When I tried to change the root password with ansible, I couldn't access it.
When I tried to make a VPC with AWS CDK but couldn't make it
Somehow the code I wrote worked and I was impressed, so I will post it
I tried to verify the Big Bang theorem [Is it about to come back?]
I didn't understand the Resize of TensorFlow so I tried to summarize it visually.
I set up TensowFlow and was addicted to it, so make a note
As a beginner, I searched the / proc directory
I tried to scrape YouTube, but I can use the API, so don't do it.
A python beginner tried to intern at an IT company [Day 3: Going to the clouds ...]
When I tried to do socket communication with Raspberry Pi, the protocol was different
When I checked the query generated by Django, it was issued in large numbers
When I crawl the webapi that appears during rendering, it was played with CORS
It was a life I wanted to OCR on AWS Lambda to locate the characters.
What I did when I was angry to put it in with the enable-shared option