U
U
unglued2014-04-19 18:15:53
Python
unglued, 2014-04-19 18:15:53

How to read input data in python on russian code cup?

Good afternoon.
I tried my hand at RCC, but all my attempts crashed against the compiler.
Written, accepts via stdin and waits for a response via stdout
I tested my programs with the command
python main.py < test.txt
Everything works.
I upload for verification, crashes with an error:
Программа завершилась с ненулевым чего-там.
I read stdin like this: What am I doing wrong?
lines = [line.rstrip('\n') for line in sys.stdin]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kyberman, 2014-04-20
@Kyberman

Are you sure the input is the problem? Crashes in the first test? I did not participate in RCC, but in Yandex Algorithm I read the data like this:

p = []
n = int(input())
for i in range(n):
  x, y = input().split()
  x, y = int(x), int(y)
  p.append((x, y))

Everything worked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question