結果

問題 No.2559 眩しい数直線
ユーザー watayuwatayu
提出日時 2023-12-02 15:10:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 976 ms / 2,000 ms
コード長 732 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2023-12-02 15:10:22
合計ジャッジ時間 10,258 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,112 KB
testcase_01 AC 27 ms
10,112 KB
testcase_02 AC 27 ms
10,112 KB
testcase_03 AC 145 ms
10,240 KB
testcase_04 AC 164 ms
10,240 KB
testcase_05 AC 245 ms
10,240 KB
testcase_06 AC 976 ms
10,368 KB
testcase_07 AC 608 ms
10,240 KB
testcase_08 AC 532 ms
10,368 KB
testcase_09 AC 508 ms
10,240 KB
testcase_10 AC 174 ms
10,240 KB
testcase_11 AC 30 ms
10,112 KB
testcase_12 AC 67 ms
10,112 KB
testcase_13 AC 875 ms
10,368 KB
testcase_14 AC 724 ms
10,368 KB
testcase_15 AC 951 ms
10,368 KB
testcase_16 AC 47 ms
10,240 KB
testcase_17 AC 510 ms
10,240 KB
testcase_18 AC 176 ms
10,240 KB
testcase_19 AC 873 ms
10,368 KB
testcase_20 AC 300 ms
10,240 KB
testcase_21 AC 71 ms
10,240 KB
testcase_22 AC 661 ms
10,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X = map(int, input().split())
info = [None for i in range(N)]
Xes = [0 for i in range(N)]
for i in range(N):
    A, B = map(int, input().split())
    info[i] = [A, B]
    Xes[i] = A
Xes.sort()
info.sort(key=lambda x: x[0])
ans = []
for i in range(1,X+1):
    temp = 0
    for j in range(N+1):
        if j == 0:
            temp = max(temp, info[0][1]-abs(i-info[0][0]))
        elif j == N:
            temp = max(temp, info[N-1][1]-abs(i-info[N-1][0]))
        else:
            if info[j][1]-abs(i-info[j][0]) > info[j-1][1]-abs(i-info[j-1][0]):
                temp = max(temp, info[j][1]-abs(i-info[j][0]))
            else:
                temp = max(temp, info[j-1][1]-abs(i-info[j-1][0]))
    ans.append(temp)
print(*ans)
0