結果

問題 No.1715 Dinner 2
ユーザー KudeKude
提出日時 2021-10-22 22:00:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 76,680 KB
最終ジャッジ日時 2023-10-24 13:07:50
合計ジャッジ時間 9,084 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,544 KB
testcase_01 AC 38 ms
53,544 KB
testcase_02 AC 47 ms
64,148 KB
testcase_03 AC 35 ms
53,544 KB
testcase_04 AC 45 ms
62,092 KB
testcase_05 AC 43 ms
61,836 KB
testcase_06 AC 36 ms
53,544 KB
testcase_07 WA -
testcase_08 AC 46 ms
61,852 KB
testcase_09 AC 37 ms
53,544 KB
testcase_10 AC 44 ms
62,072 KB
testcase_11 AC 508 ms
76,528 KB
testcase_12 AC 502 ms
76,552 KB
testcase_13 AC 443 ms
76,588 KB
testcase_14 AC 460 ms
76,548 KB
testcase_15 AC 468 ms
76,556 KB
testcase_16 AC 396 ms
76,648 KB
testcase_17 AC 301 ms
76,488 KB
testcase_18 AC 102 ms
75,924 KB
testcase_19 AC 99 ms
75,908 KB
testcase_20 AC 103 ms
75,956 KB
testcase_21 AC 93 ms
75,960 KB
testcase_22 AC 102 ms
75,944 KB
testcase_23 AC 101 ms
76,080 KB
testcase_24 AC 103 ms
75,968 KB
testcase_25 AC 142 ms
76,292 KB
testcase_26 AC 123 ms
76,292 KB
testcase_27 AC 129 ms
76,296 KB
testcase_28 AC 136 ms
76,328 KB
testcase_29 AC 133 ms
76,292 KB
testcase_30 AC 133 ms
76,260 KB
testcase_31 AC 137 ms
76,392 KB
testcase_32 AC 624 ms
76,600 KB
testcase_33 AC 616 ms
76,592 KB
testcase_34 AC 618 ms
76,584 KB
testcase_35 AC 582 ms
76,680 KB
testcase_36 WA -
testcase_37 AC 36 ms
53,544 KB
testcase_38 AC 105 ms
75,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
pq = []
ans = -10 ** 18
pq = list(tuple(map(int, input().split())) for _ in range(n))

l = -10 ** 9
r = 0
while r - l > 1:
    c = (l + r) // 2
    dp = [0] * n
    for _ in range(d):
        ndp = [-10 ** 9] * n
        mx = -10 ** 9
        imx = -1
        for i in range(n):
            if dp[i] > mx:
                mx = dp[i]
                imx = i
        for i, (p, q) in enumerate(pq):
            if i != imx and mx - p >= c:
                ndp[i] = mx - p + q
        p, q = pq[imx]
        for i in range(n):
            if i != imx and dp[i] - p >= c:
                ndp[i] = max(ndp[i], dp[i] - p + q)
        dp = ndp
    if max(dp) == -10 ** 9:
        r = c
    else:
        l = c
print(l)
0