結果
問題 | No.2559 眩しい数直線 |
ユーザー | viral8 |
提出日時 | 2023-12-02 14:39:47 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 113 ms / 2,000 ms |
コード長 | 1,007 bytes |
コンパイル時間 | 2,167 ms |
コンパイル使用メモリ | 80,580 KB |
実行使用メモリ | 56,036 KB |
最終ジャッジ日時 | 2023-12-02 14:39:57 |
合計ジャッジ時間 | 5,167 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
54,368 KB |
testcase_01 | AC | 57 ms
54,244 KB |
testcase_02 | AC | 56 ms
54,376 KB |
testcase_03 | AC | 86 ms
55,412 KB |
testcase_04 | AC | 80 ms
55,276 KB |
testcase_05 | AC | 92 ms
55,904 KB |
testcase_06 | AC | 109 ms
56,036 KB |
testcase_07 | AC | 107 ms
56,028 KB |
testcase_08 | AC | 109 ms
56,028 KB |
testcase_09 | AC | 97 ms
55,904 KB |
testcase_10 | AC | 91 ms
55,908 KB |
testcase_11 | AC | 72 ms
54,376 KB |
testcase_12 | AC | 78 ms
55,140 KB |
testcase_13 | AC | 106 ms
56,020 KB |
testcase_14 | AC | 113 ms
56,032 KB |
testcase_15 | AC | 111 ms
55,988 KB |
testcase_16 | AC | 76 ms
54,760 KB |
testcase_17 | AC | 105 ms
56,024 KB |
testcase_18 | AC | 82 ms
55,396 KB |
testcase_19 | AC | 106 ms
56,020 KB |
testcase_20 | AC | 100 ms
56,032 KB |
testcase_21 | AC | 78 ms
54,876 KB |
testcase_22 | AC | 105 ms
56,024 KB |
ソースコード
import java.util.*; import java.io.*; class Main{ private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static final PrintWriter out = new PrintWriter(System.out); public static void main(String[] args)throws IOException{ String[] str = br.readLine().split(" "); int N = Integer.parseInt(str[0]); int X = Integer.parseInt(str[1]); int[][] AB = new int[N][2]; for(int i=0;i<N;i++){ str = br.readLine().split(" "); AB[i][0] = Integer.parseInt(str[0]); AB[i][1] = Integer.parseInt(str[1]); } Arrays.sort(AB,(a,b)->Integer.compare(a[0],b[0])); int[] L = new int[X+1]; for(int i=0;i<N;i++){ for(int j=0;j<AB[i][1];j++){ if(j+AB[i][0]<=X) L[AB[i][0]+j] = Math.max(L[AB[i][0]+j],AB[i][1]-j); if(AB[i][0]-j>0) L[AB[i][0]-j] = Math.max(L[AB[i][0]-j],AB[i][1]-j); } } out.print(L[1]); for(int i=2;i<=X;i++){ out.print(" "); out.print(L[i]); } out.println(); br.close(); out.close(); } }