結果

問題 No.1715 Dinner 2
ユーザー tamatotamato
提出日時 2021-10-22 22:19:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,202 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 75,440 KB
最終ジャッジ日時 2023-10-24 13:34:16
合計ジャッジ時間 4,510 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,696 KB
testcase_01 AC 36 ms
53,696 KB
testcase_02 AC 44 ms
62,192 KB
testcase_03 AC 36 ms
53,696 KB
testcase_04 AC 42 ms
59,932 KB
testcase_05 AC 41 ms
59,440 KB
testcase_06 AC 36 ms
53,696 KB
testcase_07 AC 41 ms
59,932 KB
testcase_08 AC 40 ms
59,444 KB
testcase_09 AC 36 ms
53,696 KB
testcase_10 AC 45 ms
59,932 KB
testcase_11 AC 182 ms
75,424 KB
testcase_12 AC 163 ms
75,428 KB
testcase_13 AC 131 ms
72,452 KB
testcase_14 AC 150 ms
75,424 KB
testcase_15 AC 161 ms
75,424 KB
testcase_16 AC 158 ms
75,420 KB
testcase_17 AC 123 ms
75,424 KB
testcase_18 AC 50 ms
68,348 KB
testcase_19 AC 49 ms
68,340 KB
testcase_20 AC 49 ms
66,304 KB
testcase_21 AC 45 ms
64,036 KB
testcase_22 AC 46 ms
68,268 KB
testcase_23 AC 51 ms
72,364 KB
testcase_24 AC 48 ms
66,300 KB
testcase_25 AC 61 ms
72,480 KB
testcase_26 AC 62 ms
75,400 KB
testcase_27 AC 55 ms
70,392 KB
testcase_28 AC 60 ms
72,440 KB
testcase_29 AC 60 ms
72,440 KB
testcase_30 AC 61 ms
73,364 KB
testcase_31 AC 60 ms
72,440 KB
testcase_32 AC 212 ms
75,432 KB
testcase_33 AC 212 ms
75,440 KB
testcase_34 AC 231 ms
75,428 KB
testcase_35 AC 228 ms
75,432 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N, D = map(int, input().split())
    P = []
    Q = []
    for _ in range(N):
        p, q = map(int, input().split())
        P.append(p)
        Q.append(q)

    ok = -10 ** 9
    ng = 0
    mid = (ok + ng) // 2
    while ng - ok > 1:
        prev = -1
        cur = 0
        flg = 1
        for d in range(D):
            best = -10**9
            best_i = []
            for i in range(N):
                if cur - P[i] < mid:
                    continue
                if i == prev:
                    continue
                cur_new = cur - P[i] + Q[i]
                if cur_new > best:
                    best_i = [i]
                    best = cur_new
                elif cur_new == best:
                    best_i.append(i)
            if not best_i:
                flg = 0
                break
            if len(best_i) > 1:
                prev = -1
            else:
                prev = best_i[0]
            cur = best
        if flg == 0:
            ng = mid
        else:
            ok = mid
        mid = (ok + ng) // 2
    print(ok)


if __name__ == '__main__':
    main()
0