# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1255325 | tgirolami09 | Infinite Race (EGOI24_infiniterace2) | Pypy 3 | 214 ms | 54716 KiB |
nbParti = int(input())
nbActions = int(input())
personIsInFront = [True for i in range(nbParti+1)]
lastCyclePassedPerson = [-1 for i in range(nbParti+1)]
nbCycles = 0
for i in range(nbActions):
action = int(input())
#Overtake
if (action > 0):
#Passing person that was already passed in the current cycle
if (personIsInFront[action] == False and lastCyclePassedPerson[action] == nbCycles):
nbCycles += 1
personIsInFront[action] = False
lastCyclePassedPerson[action] = nbCycles
#Got overtaken
else:
personIsInFront[abs(action)] = True
print(nbCycles)
Compilation message (stdout)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |