結果

問題 No.771 しおり
ユーザー Nikkuniku029Nikkuniku029
提出日時 2022-11-04 12:08:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,462 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 133,980 KB
最終ジャッジ日時 2023-09-29 13:13:50
合計ジャッジ時間 20,535 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,462 ms
133,540 KB
testcase_01 AC 212 ms
84,180 KB
testcase_02 AC 71 ms
71,228 KB
testcase_03 AC 70 ms
71,136 KB
testcase_04 AC 70 ms
71,360 KB
testcase_05 AC 71 ms
71,140 KB
testcase_06 AC 70 ms
70,976 KB
testcase_07 AC 70 ms
71,268 KB
testcase_08 AC 101 ms
76,852 KB
testcase_09 AC 71 ms
71,268 KB
testcase_10 AC 69 ms
71,364 KB
testcase_11 AC 71 ms
71,356 KB
testcase_12 AC 72 ms
71,396 KB
testcase_13 AC 70 ms
71,240 KB
testcase_14 AC 94 ms
76,716 KB
testcase_15 AC 71 ms
71,272 KB
testcase_16 AC 75 ms
76,176 KB
testcase_17 AC 89 ms
76,568 KB
testcase_18 AC 69 ms
71,276 KB
testcase_19 AC 75 ms
76,036 KB
testcase_20 AC 70 ms
71,404 KB
testcase_21 AC 70 ms
71,332 KB
testcase_22 AC 76 ms
76,136 KB
testcase_23 AC 79 ms
76,384 KB
testcase_24 AC 93 ms
76,744 KB
testcase_25 AC 651 ms
105,164 KB
testcase_26 AC 105 ms
77,260 KB
testcase_27 AC 212 ms
83,860 KB
testcase_28 AC 391 ms
90,744 KB
testcase_29 AC 214 ms
83,280 KB
testcase_30 AC 1,235 ms
133,716 KB
testcase_31 AC 1,403 ms
133,544 KB
testcase_32 AC 117 ms
78,928 KB
testcase_33 AC 1,352 ms
133,980 KB
testcase_34 AC 1,260 ms
133,824 KB
testcase_35 AC 119 ms
78,848 KB
testcase_36 AC 101 ms
76,696 KB
testcase_37 AC 100 ms
77,216 KB
testcase_38 AC 117 ms
78,440 KB
testcase_39 AC 100 ms
77,400 KB
testcase_40 AC 608 ms
105,220 KB
testcase_41 AC 1,389 ms
133,500 KB
testcase_42 AC 1,317 ms
133,536 KB
testcase_43 AC 212 ms
83,952 KB
testcase_44 AC 1,436 ms
133,624 KB
testcase_45 AC 1,240 ms
133,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
books = [list(map(int, input().split())) for _ in range(N)]
INF = 1 << 62
dp = [[INF]*N for _ in range(1 << N)]
for i in range(N):
    dp[1 << i][i] = 0

for s in range(1 << N):
    for u in range(N):
        if not s & (1 << u) and s != 0:
            continue
        for v in range(N):
            if s & (1 << v):
                continue
            dp[s | (1 << v)][v] = min(dp[s | (1 << v)][v], max(
                dp[s][u], books[u][1]-books[u][0]+books[v][0]))

print(min(dp[(1 << N)-1]))
0