結果

問題 No.1715 Dinner 2
ユーザー rlangevinrlangevin
提出日時 2023-11-20 12:44:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 627 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 72,596 KB
最終ジャッジ日時 2023-11-20 12:44:06
合計ジャッジ時間 5,433 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,588 KB
testcase_01 AC 37 ms
53,588 KB
testcase_02 AC 37 ms
53,588 KB
testcase_03 AC 37 ms
53,588 KB
testcase_04 AC 37 ms
53,588 KB
testcase_05 WA -
testcase_06 AC 37 ms
53,588 KB
testcase_07 AC 38 ms
53,588 KB
testcase_08 AC 38 ms
53,588 KB
testcase_09 AC 38 ms
53,588 KB
testcase_10 WA -
testcase_11 AC 83 ms
70,520 KB
testcase_12 AC 72 ms
68,444 KB
testcase_13 AC 74 ms
68,440 KB
testcase_14 AC 70 ms
68,444 KB
testcase_15 AC 72 ms
66,364 KB
testcase_16 AC 77 ms
70,524 KB
testcase_17 AC 74 ms
70,532 KB
testcase_18 AC 38 ms
53,588 KB
testcase_19 AC 37 ms
53,588 KB
testcase_20 AC 36 ms
53,588 KB
testcase_21 AC 37 ms
53,588 KB
testcase_22 AC 37 ms
53,588 KB
testcase_23 AC 37 ms
53,588 KB
testcase_24 AC 38 ms
53,588 KB
testcase_25 AC 59 ms
66,000 KB
testcase_26 AC 51 ms
63,908 KB
testcase_27 AC 59 ms
65,996 KB
testcase_28 AC 56 ms
65,996 KB
testcase_29 AC 54 ms
65,996 KB
testcase_30 AC 54 ms
63,916 KB
testcase_31 AC 53 ms
63,924 KB
testcase_32 AC 99 ms
70,516 KB
testcase_33 AC 91 ms
72,584 KB
testcase_34 AC 92 ms
72,588 KB
testcase_35 AC 91 ms
72,596 KB
testcase_36 AC 38 ms
53,588 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

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] >= 0 and R[j] >= 0:
            mi = min(-P[i], R[i] - P[j])
        else:
            now = (R[i] + R[j]) * ((D-1)//2)
            if D % 2:
                mi = -P[i]
            else:
                mi = min(-P[i], R[i] - P[j])
            if now <= 0:
                mi += now
        ans = max(ans, mi)

print(ans)
0