Submission #1926140
Source Code Expand
Copy
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define Mod 1000000000 + 7 #define Maxn 1000000 + 100 typedef long long ll; using namespace std; bool cmp(int x,int y) { return x < y; } int gcd(int x,int y) { return 0; } ll quick_mod() { return 0; } ll n,ans,c[Maxn],s[Maxn],f[Maxn]; int main() { cin>>n; for (int i = 1; i < n; i++) cin>>c[i]>>s[i]>>f[i]; for (int i = 1; i < n; i++) { ans = c[i] + s[i]; for (int j = i + 1; j < n; j++) { if(c[i] + s[i] < s[j]) { ans = c[j] + s[j]; } else if( ans % f[j] != 0) { ans = ( ans / f[j] + 1 ) * f[j] + c[j]; } else { ans += c[j]; } } cout<<ans<<endl; } cout<<"0"<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Special Trains |
User | SpiffyEight77 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1000 Byte |
Status | WA |
Exec Time | 5 ms |
Memory | 4352 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 4 ms | 4352 KB |
02.txt | WA | 4 ms | 4352 KB |
03.txt | WA | 4 ms | 4352 KB |
04.txt | WA | 4 ms | 4352 KB |
05.txt | AC | 5 ms | 4352 KB |
06.txt | AC | 4 ms | 4352 KB |
07.txt | AC | 5 ms | 4352 KB |
08.txt | WA | 4 ms | 4352 KB |
09.txt | AC | 2 ms | 4352 KB |
10.txt | WA | 3 ms | 4352 KB |
11.txt | WA | 4 ms | 4352 KB |
12.txt | WA | 2 ms | 4352 KB |
sample_01.txt | AC | 2 ms | 4352 KB |
sample_02.txt | AC | 2 ms | 4352 KB |
sample_03.txt | AC | 2 ms | 4352 KB |