結果

問題 No.771 しおり
ユーザー convexineqconvexineq
提出日時 2021-05-21 01:47:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 974 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 82,080 KB
実行使用メモリ 132,988 KB
最終ジャッジ日時 2024-07-22 07:28:50
合計ジャッジ時間 14,043 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 974 ms
132,988 KB
testcase_01 AC 150 ms
82,136 KB
testcase_02 AC 38 ms
53,920 KB
testcase_03 AC 37 ms
52,912 KB
testcase_04 AC 37 ms
53,100 KB
testcase_05 AC 39 ms
53,592 KB
testcase_06 AC 38 ms
51,752 KB
testcase_07 AC 39 ms
52,628 KB
testcase_08 AC 59 ms
67,244 KB
testcase_09 AC 38 ms
53,500 KB
testcase_10 AC 37 ms
51,888 KB
testcase_11 AC 40 ms
52,936 KB
testcase_12 AC 38 ms
52,164 KB
testcase_13 AC 38 ms
53,080 KB
testcase_14 AC 62 ms
68,712 KB
testcase_15 AC 38 ms
53,096 KB
testcase_16 AC 44 ms
58,652 KB
testcase_17 AC 54 ms
64,632 KB
testcase_18 AC 39 ms
52,636 KB
testcase_19 AC 43 ms
59,896 KB
testcase_20 AC 37 ms
52,432 KB
testcase_21 AC 39 ms
52,476 KB
testcase_22 AC 43 ms
59,168 KB
testcase_23 AC 48 ms
61,796 KB
testcase_24 AC 54 ms
65,964 KB
testcase_25 AC 442 ms
103,764 KB
testcase_26 AC 67 ms
70,640 KB
testcase_27 AC 156 ms
82,144 KB
testcase_28 AC 294 ms
89,604 KB
testcase_29 AC 148 ms
82,488 KB
testcase_30 AC 872 ms
132,312 KB
testcase_31 AC 966 ms
132,172 KB
testcase_32 AC 87 ms
77,428 KB
testcase_33 AC 964 ms
132,352 KB
testcase_34 AC 842 ms
132,412 KB
testcase_35 AC 92 ms
76,984 KB
testcase_36 AC 64 ms
70,308 KB
testcase_37 AC 68 ms
70,768 KB
testcase_38 AC 93 ms
77,004 KB
testcase_39 AC 68 ms
71,500 KB
testcase_40 AC 487 ms
103,468 KB
testcase_41 AC 918 ms
132,464 KB
testcase_42 AC 966 ms
132,252 KB
testcase_43 AC 146 ms
82,824 KB
testcase_44 AC 900 ms
132,484 KB
testcase_45 AC 805 ms
132,168 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