結果

問題 No.771 しおり
ユーザー ああいいああいい
提出日時 2022-05-18 10:12:35
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,181 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 134,052 KB
最終ジャッジ日時 2023-09-29 13:10:04
合計ジャッジ時間 17,746 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,116 ms
133,776 KB
testcase_01 AC 183 ms
83,844 KB
testcase_02 AC 70 ms
71,380 KB
testcase_03 AC 67 ms
71,256 KB
testcase_04 AC 68 ms
71,260 KB
testcase_05 AC 70 ms
71,332 KB
testcase_06 AC 69 ms
71,360 KB
testcase_07 AC 67 ms
71,440 KB
testcase_08 AC 91 ms
76,664 KB
testcase_09 AC 69 ms
71,292 KB
testcase_10 AC 70 ms
71,256 KB
testcase_11 AC 68 ms
71,320 KB
testcase_12 AC 69 ms
71,292 KB
testcase_13 AC 69 ms
71,152 KB
testcase_14 AC 90 ms
76,708 KB
testcase_15 AC 71 ms
70,972 KB
testcase_16 AC 73 ms
75,692 KB
testcase_17 AC 88 ms
76,540 KB
testcase_18 AC 72 ms
71,336 KB
testcase_19 AC 73 ms
75,776 KB
testcase_20 AC 69 ms
71,148 KB
testcase_21 AC 71 ms
71,008 KB
testcase_22 AC 73 ms
75,852 KB
testcase_23 AC 80 ms
76,488 KB
testcase_24 AC 87 ms
76,556 KB
testcase_25 AC 529 ms
105,424 KB
testcase_26 AC 101 ms
76,724 KB
testcase_27 AC 183 ms
83,832 KB
testcase_28 AC 332 ms
90,768 KB
testcase_29 AC 186 ms
83,864 KB
testcase_30 AC 1,154 ms
134,000 KB
testcase_31 AC 1,175 ms
133,960 KB
testcase_32 AC 105 ms
76,664 KB
testcase_33 AC 1,181 ms
133,988 KB
testcase_34 AC 1,166 ms
133,996 KB
testcase_35 AC 112 ms
78,788 KB
testcase_36 AC 95 ms
76,808 KB
testcase_37 AC 101 ms
77,724 KB
testcase_38 AC 109 ms
78,668 KB
testcase_39 AC 93 ms
76,688 KB
testcase_40 AC 490 ms
105,016 KB
testcase_41 AC 1,166 ms
134,044 KB
testcase_42 AC 1,145 ms
134,052 KB
testcase_43 AC 184 ms
83,448 KB
testcase_44 AC 1,146 ms
133,996 KB
testcase_45 AC 1,068 ms
133,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
hon = []
for _ in range(N):
    a,b = map(int,input().split())
    hon.append((a,b))
inf = 10 ** 8

dp = [[inf] * N for _ in range(1 << N)]
for i in range(N):
    dp[1 << i][i] = 0
for bit in range(1,1 << N):
    for i in range(N):
        if bit >> i & 1:
            for j in range(N):
                maskj = 1 << j
                if bit & maskj == 0:
                    u = hon[i][1] - hon[i][0] + hon[j][0]
                    dp[bit | maskj][j] = min(dp[bit | maskj][j],max(dp[bit][i],u))
ans = inf
for i in range(N):
    if dp[-1][i] < ans:
        ans = dp[-1][i]
print(ans)
0