結果

問題 No.771 しおり
ユーザー 👑 tipstar0125tipstar0125
提出日時 2024-01-31 16:56:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,143 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 131,732 KB
最終ジャッジ日時 2024-01-31 16:56:57
合計ジャッジ時間 17,382 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,044 ms
131,732 KB
testcase_01 AC 169 ms
81,936 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 63 ms
68,352 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 36 ms
53,460 KB
testcase_12 AC 36 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 62 ms
68,328 KB
testcase_15 AC 37 ms
53,460 KB
testcase_16 AC 42 ms
59,580 KB
testcase_17 AC 57 ms
66,268 KB
testcase_18 AC 37 ms
53,460 KB
testcase_19 AC 42 ms
59,580 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 37 ms
53,460 KB
testcase_22 AC 42 ms
59,580 KB
testcase_23 AC 50 ms
64,184 KB
testcase_24 AC 58 ms
66,264 KB
testcase_25 AC 598 ms
103,188 KB
testcase_26 AC 81 ms
76,320 KB
testcase_27 AC 165 ms
81,936 KB
testcase_28 AC 353 ms
88,852 KB
testcase_29 AC 169 ms
81,936 KB
testcase_30 AC 1,122 ms
131,732 KB
testcase_31 AC 1,143 ms
131,732 KB
testcase_32 AC 86 ms
77,020 KB
testcase_33 AC 1,089 ms
131,732 KB
testcase_34 AC 1,039 ms
131,732 KB
testcase_35 AC 86 ms
77,012 KB
testcase_36 AC 68 ms
70,532 KB
testcase_37 AC 69 ms
72,608 KB
testcase_38 AC 89 ms
77,012 KB
testcase_39 AC 68 ms
72,608 KB
testcase_40 AC 603 ms
103,060 KB
testcase_41 AC 1,082 ms
131,732 KB
testcase_42 AC 1,051 ms
131,732 KB
testcase_43 AC 165 ms
81,936 KB
testcase_44 AC 1,043 ms
131,732 KB
testcase_45 AC 1,014 ms
131,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
LR=[]
for _ in range(N):
    a,b=map(int,input().split())
    LR.append((a,b-a))
MAX=1<<N
INF=int(1e18)
dp=[[INF for _ in range(N)] for _ in range(MAX)]
for i in range(N):dp[1<<i][i]=0
for s in range(1,MAX):
    for frm in range(N):
        if s&(1<<frm)==0:continue
        for to in range(N):
            if s&(1<<to)==0:continue
            bs=s^(1<<to)
            _,r=LR[frm]
            l,_=LR[to]
            cost=max(dp[bs][frm],l+r)
            dp[s][to]=min(dp[s][to],cost)
ans=min(dp[-1])
print(ans)
0