結果
問題 |
No.139 交差点
|
ユーザー |
![]() |
提出日時 | 2020-02-14 15:41:49 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 600 bytes |
コンパイル時間 | 2,018 ms |
コンパイル使用メモリ | 74,000 KB |
実行使用メモリ | 54,524 KB |
最終ジャッジ日時 | 2024-10-06 07:58:11 |
合計ジャッジ時間 | 7,038 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int l = sc.nextInt(); int current = 0; long total = 0; for (int i = 0; i < n; i++) { int x = sc.nextInt(); int w = sc.nextInt(); int t = sc.nextInt(); total += x - current; if (total % (2 * t) <= t && (total + w) % (2 * t) <= t) { } else { total += 2 * t - total % (t * 2); } total += w; current = x + w; } total += l - current; System.out.println(total); } }