結果

問題 No.139 交差点
ユーザー htensaihtensai
提出日時 2019-12-26 12:47:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 848 bytes
コンパイル時間 2,851 ms
コンパイル使用メモリ 80,360 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2024-04-14 11:05:35
合計ジャッジ時間 8,614 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
53,764 KB
testcase_01 AC 126 ms
54,120 KB
testcase_02 AC 128 ms
53,856 KB
testcase_03 AC 133 ms
54,300 KB
testcase_04 AC 139 ms
53,860 KB
testcase_05 AC 139 ms
53,868 KB
testcase_06 AC 134 ms
54,340 KB
testcase_07 AC 153 ms
54,360 KB
testcase_08 AC 143 ms
54,348 KB
testcase_09 AC 141 ms
54,280 KB
testcase_10 WA -
testcase_11 AC 134 ms
54,204 KB
testcase_12 AC 162 ms
53,956 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 163 ms
54,040 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 140 ms
54,412 KB
testcase_19 AC 155 ms
54,236 KB
testcase_20 AC 137 ms
54,076 KB
testcase_21 WA -
testcase_22 AC 128 ms
54,316 KB
testcase_23 AC 159 ms
54,440 KB
testcase_24 AC 127 ms
53,940 KB
testcase_25 AC 136 ms
54,036 KB
testcase_26 AC 139 ms
54,412 KB
testcase_27 AC 131 ms
53,864 KB
testcase_28 AC 135 ms
54,040 KB
testcase_29 AC 141 ms
54,284 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
        long total = 0;
        int cur = 0;
        for (int i = 0; i < n; i++) {
            int point = sc.nextInt();
            int width = sc.nextInt();
            int time = sc.nextInt();
            long start = total + point - cur;
            long end = total + point + width - cur;
            if (start / time % 2 == 1 || end / time % 2 == 1 || start / time != end / time) {
                cur = point;
                total = (start / (time * 2) + 1) * time * 2;
            } else {
                cur = point + width;
                total = end;
            }
        }
        total += l - cur;
        System.out.println(total);
    }
}
0