結果

問題 No.1715 Dinner 2
ユーザー rlangevinrlangevin
提出日時 2023-11-20 12:51:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 68,452 KB
最終ジャッジ日時 2023-11-20 12:51:07
合計ジャッジ時間 3,991 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,588 KB
testcase_01 AC 36 ms
53,588 KB
testcase_02 AC 37 ms
53,588 KB
testcase_03 AC 38 ms
53,588 KB
testcase_04 AC 42 ms
53,588 KB
testcase_05 AC 37 ms
53,588 KB
testcase_06 AC 37 ms
53,588 KB
testcase_07 AC 37 ms
53,588 KB
testcase_08 AC 37 ms
53,588 KB
testcase_09 AC 37 ms
53,588 KB
testcase_10 AC 38 ms
53,588 KB
testcase_11 AC 66 ms
66,368 KB
testcase_12 AC 76 ms
68,444 KB
testcase_13 AC 80 ms
68,440 KB
testcase_14 AC 74 ms
68,452 KB
testcase_15 AC 79 ms
68,444 KB
testcase_16 AC 65 ms
66,368 KB
testcase_17 AC 60 ms
66,368 KB
testcase_18 AC 37 ms
53,588 KB
testcase_19 AC 37 ms
53,588 KB
testcase_20 AC 37 ms
53,588 KB
testcase_21 AC 37 ms
53,588 KB
testcase_22 AC 37 ms
53,588 KB
testcase_23 AC 60 ms
53,588 KB
testcase_24 AC 37 ms
53,588 KB
testcase_25 AC 52 ms
63,920 KB
testcase_26 AC 54 ms
63,908 KB
testcase_27 AC 50 ms
63,916 KB
testcase_28 AC 52 ms
63,920 KB
testcase_29 AC 49 ms
61,840 KB
testcase_30 AC 49 ms
61,840 KB
testcase_31 AC 54 ms
63,916 KB
testcase_32 AC 75 ms
66,360 KB
testcase_33 AC 73 ms
66,356 KB
testcase_34 AC 76 ms
66,364 KB
testcase_35 AC 73 ms
66,348 KB
testcase_36 AC 38 ms
53,588 KB
testcase_37 WA -
testcase_38 AC 38 ms
53,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, D = map(int, input().split())
P, Q, R = [0] * N, [0] * N, [0] * N
for i in range(N):
    P[i], Q[i] = map(int, input().split())
    R[i] = Q[i] - P[i]

ans = -10**18
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        if R[i] + R[j] >= 0:
            mi = min(-P[i], R[i] - P[j])
        else:
            now = (R[i] + R[j]) * ((D-3)//2)
            if D % 2:
                mi = min(-P[i], R[i] - P[j], R[i] + R[j] - P[i])
            else:
                mi = min(-P[i], R[i] - P[j])
            if now <= 0:
                mi += now
        ans = max(ans, mi)

print(ans)
0