結果

問題 No.771 しおり
ユーザー roarisroaris
提出日時 2019-08-19 16:11:45
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 561 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 133,720 KB
最終ジャッジ日時 2023-10-07 22:14:28
合計ジャッジ時間 27,925 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,864 ms
133,468 KB
testcase_01 AC 241 ms
83,780 KB
testcase_02 AC 70 ms
71,392 KB
testcase_03 AC 71 ms
71,396 KB
testcase_04 AC 71 ms
71,336 KB
testcase_05 AC 72 ms
71,548 KB
testcase_06 AC 70 ms
71,180 KB
testcase_07 AC 71 ms
71,152 KB
testcase_08 AC 91 ms
76,784 KB
testcase_09 AC 72 ms
71,592 KB
testcase_10 AC 72 ms
71,608 KB
testcase_11 AC 70 ms
71,404 KB
testcase_12 AC 72 ms
71,388 KB
testcase_13 AC 74 ms
71,348 KB
testcase_14 AC 91 ms
76,796 KB
testcase_15 AC 72 ms
71,404 KB
testcase_16 AC 81 ms
76,384 KB
testcase_17 AC 90 ms
76,948 KB
testcase_18 AC 72 ms
71,668 KB
testcase_19 AC 81 ms
76,300 KB
testcase_20 AC 71 ms
71,404 KB
testcase_21 AC 71 ms
71,196 KB
testcase_22 AC 81 ms
76,232 KB
testcase_23 AC 89 ms
76,916 KB
testcase_24 AC 87 ms
76,760 KB
testcase_25 AC 847 ms
104,924 KB
testcase_26 AC 108 ms
77,792 KB
testcase_27 AC 283 ms
83,616 KB
testcase_28 AC 537 ms
90,648 KB
testcase_29 AC 239 ms
83,844 KB
testcase_30 AC 1,859 ms
133,524 KB
testcase_31 TLE -
testcase_32 AC 133 ms
78,736 KB
testcase_33 AC 1,690 ms
133,320 KB
testcase_34 TLE -
testcase_35 AC 129 ms
78,788 KB
testcase_36 AC 97 ms
76,680 KB
testcase_37 AC 96 ms
76,812 KB
testcase_38 AC 126 ms
78,776 KB
testcase_39 AC 96 ms
76,860 KB
testcase_40 AC 812 ms
104,892 KB
testcase_41 AC 1,740 ms
133,404 KB
testcase_42 TLE -
testcase_43 AC 243 ms
83,768 KB
testcase_44 AC 1,774 ms
133,556 KB
testcase_45 AC 1,855 ms
133,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
A, B = [], []

for _ in range(N):
    Ai, Bi = map(int, input().split())
    A.append(Ai)
    B.append(Bi)

dp = [[10 ** 18 for _ in range(N)] for _ in range(1 << N)]

for v in range(N):
    dp[(1 << N) - 1][v] = 0
    
for S in range((1 << N) - 2, -1, -1):
    for v in range(N):
        for u in range(N):
            if not S >> u & 1:
                dp[S][v] = min(dp[S][v], max(dp[S | 1 << u][u], B[v] - A[v] + A[u]))

ans = 10 ** 18

for i in range(N):
    ans = min(ans, dp[1 << i][i])

print(ans)
0