結果

問題 No.771 しおり
ユーザー AEnAEn
提出日時 2022-06-21 00:27:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,620 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 134,360 KB
最終ジャッジ日時 2023-09-29 13:11:48
合計ジャッジ時間 21,802 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,620 ms
134,228 KB
testcase_01 AC 214 ms
84,048 KB
testcase_02 AC 74 ms
71,580 KB
testcase_03 AC 74 ms
71,388 KB
testcase_04 AC 75 ms
71,456 KB
testcase_05 AC 72 ms
71,340 KB
testcase_06 AC 74 ms
71,224 KB
testcase_07 AC 74 ms
71,108 KB
testcase_08 AC 111 ms
77,640 KB
testcase_09 AC 73 ms
71,156 KB
testcase_10 AC 73 ms
71,344 KB
testcase_11 AC 76 ms
71,376 KB
testcase_12 AC 74 ms
71,152 KB
testcase_13 AC 75 ms
71,380 KB
testcase_14 AC 111 ms
77,464 KB
testcase_15 AC 74 ms
71,404 KB
testcase_16 AC 78 ms
75,928 KB
testcase_17 AC 94 ms
76,680 KB
testcase_18 AC 73 ms
71,308 KB
testcase_19 AC 79 ms
75,928 KB
testcase_20 AC 74 ms
71,312 KB
testcase_21 AC 75 ms
71,544 KB
testcase_22 AC 78 ms
75,912 KB
testcase_23 AC 84 ms
76,340 KB
testcase_24 AC 98 ms
76,680 KB
testcase_25 AC 716 ms
105,192 KB
testcase_26 AC 128 ms
78,488 KB
testcase_27 AC 219 ms
83,956 KB
testcase_28 AC 392 ms
91,176 KB
testcase_29 AC 225 ms
84,028 KB
testcase_30 AC 1,400 ms
134,048 KB
testcase_31 AC 1,457 ms
134,360 KB
testcase_32 AC 134 ms
79,304 KB
testcase_33 AC 1,451 ms
134,288 KB
testcase_34 AC 1,352 ms
134,156 KB
testcase_35 AC 135 ms
79,264 KB
testcase_36 AC 120 ms
77,876 KB
testcase_37 AC 117 ms
77,976 KB
testcase_38 AC 133 ms
79,216 KB
testcase_39 AC 117 ms
78,148 KB
testcase_40 AC 586 ms
105,472 KB
testcase_41 AC 1,489 ms
134,312 KB
testcase_42 AC 1,305 ms
134,156 KB
testcase_43 AC 221 ms
84,124 KB
testcase_44 AC 1,359 ms
134,176 KB
testcase_45 AC 1,389 ms
134,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
c = []
for i in range(N):
    l, r = map(int, input().split())
    c.append([l, r-l])

# 整列済み本の集合iを任意の順で並べて、最後尾がj
dp = [[0]*N for _ in range(1<<N)]
for i in range(1,1<<N):
    for j in range(N):
        if not i & (1<<j):
            continue
        for k in range(N):
            if j == k or i & (1<<k):
                continue
            if dp[i ^ (1<<k)][k] == 0:
                dp[i ^ (1<<k)][k] = max(dp[i][j], c[j][1]+c[k][0])
            else:
                dp[i ^ (1<<k)][k] = min(dp[i ^ (1<<k)][k], max(dp[i][j], c[j][1]+c[k][0]))
print(min(dp[-1]))
0