結果
問題 |
No.139 交差点
|
ユーザー |
|
提出日時 | 2017-01-31 17:23:16 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 596 bytes |
コンパイル時間 | 1,025 ms |
コンパイル使用メモリ | 142,284 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 06:48:29 |
合計ジャッジ時間 | 2,321 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 10 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { auto rd1 = readln.split, n = rd1[0].to!size_t, l = rd1[1].to!int; auto xi = new int[](n), wi = new int[](n), ti = new int[](n); foreach (i; n.iota) { auto rd2 = readln.split.to!(int[]); xi[i] = rd2[0]; wi[i] = rd2[1]; ti[i] = rd2[2]; } auto ct = 0, cx = 0; foreach (x, w, t; lockstep(xi, wi, ti)) { ct += x - cx; cx = x; if ((ct + w) / t % 2 == 1 && (ct + w) % t != 0) ct = (ct / (2 * t) + 1) * (2 * t); ct += w; cx += w; } ct += l - cx; writeln(ct); }