結果

問題 No.771 しおり
ユーザー convexineqconvexineq
提出日時 2021-05-21 01:47:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,035 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 134,080 KB
最終ジャッジ日時 2023-09-29 13:08:36
合計ジャッジ時間 16,376 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,035 ms
134,016 KB
testcase_01 AC 186 ms
84,256 KB
testcase_02 AC 73 ms
71,560 KB
testcase_03 AC 74 ms
71,428 KB
testcase_04 AC 72 ms
71,308 KB
testcase_05 AC 72 ms
71,556 KB
testcase_06 AC 73 ms
71,304 KB
testcase_07 AC 74 ms
71,128 KB
testcase_08 AC 94 ms
76,884 KB
testcase_09 AC 73 ms
71,304 KB
testcase_10 AC 73 ms
71,456 KB
testcase_11 AC 73 ms
71,408 KB
testcase_12 AC 75 ms
71,408 KB
testcase_13 AC 74 ms
71,140 KB
testcase_14 AC 97 ms
76,468 KB
testcase_15 AC 74 ms
71,648 KB
testcase_16 AC 80 ms
76,100 KB
testcase_17 AC 90 ms
76,672 KB
testcase_18 AC 74 ms
71,652 KB
testcase_19 AC 79 ms
75,916 KB
testcase_20 AC 75 ms
71,596 KB
testcase_21 AC 73 ms
71,556 KB
testcase_22 AC 79 ms
76,000 KB
testcase_23 AC 84 ms
76,008 KB
testcase_24 AC 89 ms
76,632 KB
testcase_25 AC 487 ms
105,388 KB
testcase_26 AC 101 ms
76,792 KB
testcase_27 AC 186 ms
84,216 KB
testcase_28 AC 334 ms
90,856 KB
testcase_29 AC 184 ms
83,968 KB
testcase_30 AC 919 ms
133,996 KB
testcase_31 AC 1,013 ms
133,892 KB
testcase_32 AC 124 ms
78,880 KB
testcase_33 AC 1,029 ms
133,812 KB
testcase_34 AC 890 ms
133,796 KB
testcase_35 AC 125 ms
78,844 KB
testcase_36 AC 101 ms
76,656 KB
testcase_37 AC 102 ms
76,852 KB
testcase_38 AC 124 ms
78,836 KB
testcase_39 AC 101 ms
76,844 KB
testcase_40 AC 518 ms
105,232 KB
testcase_41 AC 958 ms
134,016 KB
testcase_42 AC 1,030 ms
133,764 KB
testcase_43 AC 182 ms
83,904 KB
testcase_44 AC 958 ms
134,080 KB
testcase_45 AC 853 ms
133,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())

N = 1<<n
INF = 1<<30
dp = [[INF]*n for _ in range(N)]
for i in range(n):
    dp[1<<i][i] = 0

for mask in range(N):
    for j in range(n):
        if mask>>j&1: continue
        res = INF
        for i in range(n):
            if mask>>i&1==0: continue
            res = min(res,max(dp[mask][i],a[j]+b[i]-a[i]))
        dp[mask|(1<<j)][j] = min(dp[mask|(1<<j)][j], res)

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