Submission #4077103
Source Code Expand
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
const int M=500;
int N,C[M],S[M],F[M],i,j,t;
inline void solve(){
IN(N);
INS3(i,N-1,C,S,F);
REP(i,N){
t=0;
FOR(j,i,N-1){
if(t<S[j])t=S[j];
else if((t-S[j])%F[j]!=0)t=t+F[j]-t%F[j];
t+=C[j];
}
OUT(t);
}
}
int main(int argc,char**argv){
BEGIN;
solve();
END;
}
Submission Info
Submission Time |
|
Task |
C - Special Trains |
User |
hryshtk |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1151 Byte |
Status |
AC |
Exec Time |
4 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
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 |
AC |
4 ms |
256 KB |
02.txt |
AC |
4 ms |
256 KB |
03.txt |
AC |
4 ms |
256 KB |
04.txt |
AC |
4 ms |
256 KB |
05.txt |
AC |
4 ms |
256 KB |
06.txt |
AC |
3 ms |
256 KB |
07.txt |
AC |
4 ms |
256 KB |
08.txt |
AC |
4 ms |
256 KB |
09.txt |
AC |
1 ms |
256 KB |
10.txt |
AC |
2 ms |
256 KB |
11.txt |
AC |
3 ms |
256 KB |
12.txt |
AC |
2 ms |
256 KB |
sample_01.txt |
AC |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
sample_03.txt |
AC |
1 ms |
256 KB |