Submission #2124001
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC084C { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int[] C = new int[N - 1]; int[] S = new int[N - 1]; int[] F = new int[N - 1]; for (int i = 0; i < N - 1; i++) { int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); C[i] = input[0]; S[i] = input[1]; F[i] = input[2]; } for (int i = 0; i < N; i++) { int time = 0; int start = 0; for (int j = 0; j < (N - i - 1); j++) { if (S[i + j] >= time) { start = S[i + j]; } else { start = S[i + j] + ((time - S[i + j] + F[i + j] - 1) / F[i + j]) * F[i + j]; } time = start + C[i + j]; } Console.WriteLine(time); } } } }
Submission Info
Submission Time | |
---|---|
Task | C - Special Trains |
User | NMLibrary |
Language | C# (Mono 4.6.2.0) |
Score | 300 |
Code Size | 1186 Byte |
Status | AC |
Exec Time | 28 ms |
Memory | 13396 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 | 27 ms | 11220 KB |
02.txt | AC | 27 ms | 11348 KB |
03.txt | AC | 27 ms | 9300 KB |
04.txt | AC | 27 ms | 9300 KB |
05.txt | AC | 27 ms | 11220 KB |
06.txt | AC | 27 ms | 13396 KB |
07.txt | AC | 28 ms | 11348 KB |
08.txt | AC | 27 ms | 11220 KB |
09.txt | AC | 23 ms | 11220 KB |
10.txt | AC | 25 ms | 13396 KB |
11.txt | AC | 26 ms | 9300 KB |
12.txt | AC | 24 ms | 13396 KB |
sample_01.txt | AC | 23 ms | 11348 KB |
sample_02.txt | AC | 23 ms | 11220 KB |
sample_03.txt | AC | 23 ms | 13396 KB |