結果

問題 No.2559 眩しい数直線
ユーザー loop0919loop0919
提出日時 2023-11-27 23:40:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 2,370 ms
コンパイル使用メモリ 85,304 KB
実行使用メモリ 61,680 KB
最終ジャッジ日時 2023-11-27 23:40:40
合計ジャッジ時間 8,653 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
57,956 KB
testcase_01 AC 143 ms
57,968 KB
testcase_02 AC 148 ms
58,092 KB
testcase_03 AC 211 ms
58,364 KB
testcase_04 AC 233 ms
58,592 KB
testcase_05 AC 244 ms
56,880 KB
testcase_06 AC 307 ms
61,352 KB
testcase_07 AC 274 ms
61,300 KB
testcase_08 AC 274 ms
61,076 KB
testcase_09 AC 266 ms
58,836 KB
testcase_10 AC 254 ms
58,836 KB
testcase_11 AC 168 ms
58,356 KB
testcase_12 AC 182 ms
58,344 KB
testcase_13 AC 275 ms
61,268 KB
testcase_14 AC 286 ms
61,048 KB
testcase_15 AC 319 ms
61,184 KB
testcase_16 AC 191 ms
58,344 KB
testcase_17 AC 265 ms
61,040 KB
testcase_18 AC 225 ms
58,860 KB
testcase_19 AC 286 ms
61,680 KB
testcase_20 AC 284 ms
59,312 KB
testcase_21 AC 208 ms
58,228 KB
testcase_22 AC 287 ms
61,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int X = sc.nextInt();
        
        int[] A = new int[N];
        int[] B = new int[N];
        
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            B[i] = sc.nextInt();
        }
        
        for (int x = 1; x <= X; x++) {
            int maxVal = 0;
            for (int i = 0; i < N; i++) {
                maxVal = Math.max(B[i] - Math.abs(x - A[i]), maxVal);
            }
            System.out.print(maxVal + " ");
        }
    }
}
0