結果

問題 No.771 しおり
ユーザー lloyzlloyz
提出日時 2023-10-27 00:12:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,504 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 132,400 KB
最終ジャッジ日時 2023-10-27 00:13:18
合計ジャッジ時間 20,040 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,504 ms
132,400 KB
testcase_01 AC 178 ms
82,188 KB
testcase_02 AC 36 ms
53,544 KB
testcase_03 AC 36 ms
53,544 KB
testcase_04 AC 36 ms
53,544 KB
testcase_05 AC 36 ms
53,544 KB
testcase_06 AC 36 ms
53,544 KB
testcase_07 AC 36 ms
53,544 KB
testcase_08 AC 60 ms
68,368 KB
testcase_09 AC 36 ms
53,544 KB
testcase_10 AC 36 ms
53,544 KB
testcase_11 AC 36 ms
53,544 KB
testcase_12 AC 37 ms
53,544 KB
testcase_13 AC 37 ms
53,544 KB
testcase_14 AC 63 ms
70,424 KB
testcase_15 AC 36 ms
53,544 KB
testcase_16 AC 39 ms
59,264 KB
testcase_17 AC 54 ms
66,256 KB
testcase_18 AC 37 ms
53,544 KB
testcase_19 AC 40 ms
59,264 KB
testcase_20 AC 37 ms
53,544 KB
testcase_21 AC 37 ms
53,544 KB
testcase_22 AC 40 ms
59,264 KB
testcase_23 AC 45 ms
62,068 KB
testcase_24 AC 57 ms
66,256 KB
testcase_25 AC 649 ms
103,468 KB
testcase_26 AC 74 ms
73,056 KB
testcase_27 AC 176 ms
82,192 KB
testcase_28 AC 372 ms
89,504 KB
testcase_29 AC 207 ms
82,188 KB
testcase_30 AC 1,402 ms
132,396 KB
testcase_31 AC 1,377 ms
132,396 KB
testcase_32 AC 90 ms
77,204 KB
testcase_33 AC 1,415 ms
132,396 KB
testcase_34 AC 1,399 ms
132,396 KB
testcase_35 AC 89 ms
77,196 KB
testcase_36 AC 70 ms
73,284 KB
testcase_37 AC 68 ms
72,756 KB
testcase_38 AC 87 ms
77,200 KB
testcase_39 AC 80 ms
70,692 KB
testcase_40 AC 563 ms
103,616 KB
testcase_41 AC 1,381 ms
132,396 KB
testcase_42 AC 1,355 ms
132,396 KB
testcase_43 AC 182 ms
82,344 KB
testcase_44 AC 1,489 ms
132,396 KB
testcase_45 AC 1,261 ms
132,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def main():
    n = int(input())
    A = [list(map(int, input().split())) for _ in range(n)]

    INF = 10**18
    DP = [[INF] * n for _ in range(1 << n)]
    for i in range(n):
        DP[1 << i][i] = 0
    for bit in range(1, 1 << n):
        for i in range(n):
            if (bit >> i) & 1:
                for j in range(n):
                    if (bit >> j) & 1 == 0:
                        nbit = bit | (1 << j)
                        DP[nbit][j] = min(DP[nbit][j], max(DP[bit][i], A[i][1] - A[i][0] + A[j][0]))
    print(min(DP[-1]))

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