結果
問題 | No.139 交差点 |
ユーザー | htensai |
提出日時 | 2020-02-14 15:24:37 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 619 bytes |
コンパイル時間 | 2,007 ms |
コンパイル使用メモリ | 74,436 KB |
実行使用メモリ | 56,044 KB |
最終ジャッジ日時 | 2024-04-16 00:17:07 |
合計ジャッジ時間 | 7,569 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 130 ms
53,920 KB |
testcase_01 | AC | 132 ms
54,064 KB |
testcase_02 | AC | 133 ms
54,076 KB |
testcase_03 | AC | 138 ms
53,944 KB |
testcase_04 | AC | 143 ms
54,288 KB |
testcase_05 | AC | 146 ms
54,176 KB |
testcase_06 | AC | 137 ms
54,700 KB |
testcase_07 | AC | 148 ms
54,032 KB |
testcase_08 | AC | 146 ms
54,048 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 133 ms
54,224 KB |
testcase_14 | AC | 145 ms
54,316 KB |
testcase_15 | WA | - |
testcase_16 | AC | 137 ms
53,712 KB |
testcase_17 | WA | - |
testcase_18 | AC | 144 ms
54,472 KB |
testcase_19 | AC | 149 ms
54,224 KB |
testcase_20 | AC | 140 ms
53,816 KB |
testcase_21 | AC | 132 ms
53,820 KB |
testcase_22 | AC | 131 ms
54,288 KB |
testcase_23 | AC | 156 ms
54,068 KB |
testcase_24 | AC | 132 ms
53,824 KB |
testcase_25 | WA | - |
testcase_26 | AC | 143 ms
54,196 KB |
testcase_27 | AC | 138 ms
54,016 KB |
testcase_28 | AC | 136 ms
54,048 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
ソースコード
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(); if ((total + x + w - current + t - 1) / t % 2 == 0) { total = (total + x + w - current + t - 1) / t * t; current = x; } else { total += x + w - current; current = x + w; } } total += l - current; System.out.println(total); } }