FASKEL's blog

By FASKEL, history, 4 years ago, In Russian

http://codeforces.com/contest/250/problem/A I am solving thsi problem, but it throws me a Runtime error on the first test! I do not know what the issue is, `couse it gives me a right answear when i run it on my machine...

Code:

count = int(input())

money = []
cnegative = 0
for _ in range(count):
    number = int(input())
    if number < 0:
        cnegative += 1
    money.append(number)
if cnegative <= 2:
    print(1)
    print(count)
else:
    print(round(cnegative/2))
    cnegative = 0
    border = 0
    for i in range(count):
        if money[i] < 0:
            cnegative += 1
            if cnegative == 3:
                print(i - border, end=' ')
                border = i
                cnegative = 1
    print(count - border)
  • Vote: I like it
  • -5
  • Vote: I do not like it