結果

問題 No.771 しおり
ユーザー mkawa2mkawa2
提出日時 2022-03-08 15:48:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 707 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 113,852 KB
最終ジャッジ日時 2023-09-30 21:58:47
合計ジャッジ時間 28,693 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,978 ms
113,632 KB
testcase_01 AC 273 ms
80,428 KB
testcase_02 AC 74 ms
71,140 KB
testcase_03 AC 72 ms
71,288 KB
testcase_04 AC 72 ms
71,300 KB
testcase_05 AC 73 ms
71,172 KB
testcase_06 AC 73 ms
71,316 KB
testcase_07 AC 71 ms
71,252 KB
testcase_08 AC 94 ms
76,184 KB
testcase_09 AC 71 ms
71,092 KB
testcase_10 AC 72 ms
71,320 KB
testcase_11 AC 71 ms
71,348 KB
testcase_12 AC 72 ms
71,440 KB
testcase_13 AC 74 ms
71,136 KB
testcase_14 AC 99 ms
77,084 KB
testcase_15 AC 72 ms
71,348 KB
testcase_16 AC 80 ms
75,620 KB
testcase_17 AC 91 ms
75,988 KB
testcase_18 AC 72 ms
71,068 KB
testcase_19 AC 81 ms
75,528 KB
testcase_20 AC 73 ms
71,308 KB
testcase_21 AC 72 ms
71,324 KB
testcase_22 AC 80 ms
75,604 KB
testcase_23 AC 90 ms
76,208 KB
testcase_24 AC 92 ms
76,144 KB
testcase_25 AC 986 ms
94,168 KB
testcase_26 AC 113 ms
77,080 KB
testcase_27 AC 278 ms
80,760 KB
testcase_28 AC 615 ms
85,004 KB
testcase_29 AC 277 ms
80,680 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 AC 141 ms
77,724 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 141 ms
77,612 KB
testcase_36 AC 101 ms
76,180 KB
testcase_37 AC 102 ms
76,296 KB
testcase_38 AC 138 ms
77,592 KB
testcase_39 AC 104 ms
77,052 KB
testcase_40 AC 943 ms
94,236 KB
testcase_41 TLE -
testcase_42 TLE -
testcase_43 AC 279 ms
80,852 KB
testcase_44 TLE -
testcase_45 AC 1,958 ms
113,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
inf = (1 << 63)-1

def main():
    n = II()
    ab = LLI(n)

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

    def chmin(i, s, val):
        if val < dp[i][s]: dp[i][s] = val

    for s in range(1, 1 << n):
        for i, (ai, bi) in enumerate(ab):
            pre = dp[i][s]
            for j, (aj, bj) in enumerate(ab):
                if s >> j & 1: continue
                chmin(j, s | 1 << j, max(pre, bi+aj-ai))

    ans = min(dp[i][-1] for i in range(n))
    print(ans)

main()
0