Submission #1927669


Source Code Expand

Copy
N=int(input())
C,S,F=[0]*(N-1),[0]*(N-1),[0]*(N-1)
for i in range(N-1):
    C[i],S[i],F[i]=map(int,input().split())
for i in range(N-1): #一周につき一つの駅([0]..[N-2])から[N-1]までの計算
    arrivalTime=S[i]+C[i]#最初発車駅の次の駅に着く時間
    for j in range(i+1,N-1):
        leaveTime=S[j]#現在考慮中の駅から初めて発車する時間
        if arrivalTime <leaveTime:
            pass
        elif arrivalTime % F[j]==0:
            leaveTime=arrivalTime
        else:
            leaveTime=arrivalTime+F[j]- arrivalTime % F[j]-
        '''
        while arrivalTime > leaveTime:
            leaveTime+=F[j]
        '''
        arrivalTime=leaveTime+C[j]
    print(arrivalTime)
print(0)#[N-1]駅

Submission Info

Submission Time
Task C - Special Trains
User Yodadayo
Language Python (3.4.3)
Score 0
Code Size 762 Byte
Status RE
Exec Time 17 ms
Memory 3064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
RE × 3
RE × 15
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt RE 16 ms 3064 KB
02.txt RE 17 ms 3064 KB
03.txt RE 17 ms 3064 KB
04.txt RE 17 ms 3064 KB
05.txt RE 17 ms 3060 KB
06.txt RE 17 ms 3064 KB
07.txt RE 17 ms 3064 KB
08.txt RE 17 ms 3064 KB
09.txt RE 16 ms 3060 KB
10.txt RE 16 ms 3064 KB
11.txt RE 17 ms 3060 KB
12.txt RE 17 ms 3064 KB
sample_01.txt RE 17 ms 3064 KB
sample_02.txt RE 16 ms 3064 KB
sample_03.txt RE 17 ms 3064 KB