結果

問題 No.771 しおり
ユーザー lloyzlloyz
提出日時 2023-10-27 00:10:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 732 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 132,084 KB
最終ジャッジ日時 2023-10-27 00:10:51
合計ジャッジ時間 27,090 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,984 ms
132,028 KB
testcase_01 AC 237 ms
82,196 KB
testcase_02 AC 36 ms
53,568 KB
testcase_03 AC 37 ms
53,568 KB
testcase_04 AC 36 ms
53,568 KB
testcase_05 AC 37 ms
53,568 KB
testcase_06 AC 37 ms
53,568 KB
testcase_07 AC 37 ms
53,568 KB
testcase_08 AC 69 ms
70,600 KB
testcase_09 AC 36 ms
53,568 KB
testcase_10 AC 36 ms
53,568 KB
testcase_11 AC 36 ms
53,568 KB
testcase_12 AC 38 ms
53,568 KB
testcase_13 AC 37 ms
53,568 KB
testcase_14 AC 72 ms
72,840 KB
testcase_15 AC 36 ms
53,568 KB
testcase_16 AC 38 ms
59,272 KB
testcase_17 AC 59 ms
68,488 KB
testcase_18 AC 37 ms
53,568 KB
testcase_19 AC 39 ms
59,272 KB
testcase_20 AC 36 ms
53,568 KB
testcase_21 AC 36 ms
53,568 KB
testcase_22 AC 40 ms
59,272 KB
testcase_23 AC 47 ms
62,168 KB
testcase_24 AC 60 ms
68,488 KB
testcase_25 AC 932 ms
103,228 KB
testcase_26 AC 93 ms
76,528 KB
testcase_27 AC 241 ms
82,192 KB
testcase_28 AC 547 ms
89,216 KB
testcase_29 AC 251 ms
82,196 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 AC 110 ms
77,388 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 113 ms
77,496 KB
testcase_36 AC 83 ms
76,264 KB
testcase_37 AC 83 ms
76,264 KB
testcase_38 AC 111 ms
77,332 KB
testcase_39 AC 85 ms
76,264 KB
testcase_40 AC 887 ms
103,324 KB
testcase_41 TLE -
testcase_42 AC 1,983 ms
132,024 KB
testcase_43 AC 240 ms
82,196 KB
testcase_44 TLE -
testcase_45 AC 1,844 ms
132,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def main():
    n = int(input())
    A = [list(map(int, input().split())) for _ in range(n)]

    INF = 10**18
    DP = [[INF for _ in range(n)] for _ in range(1 << n)]
    for i in range(n):
        DP[1 << i][i] = 0
    for bit in range(1, 1 << n):
        seen = set()
        for i in range(n):
            if (bit >> i) & 1:
                seen.add(i)
        for i in range(n):
            if i in seen:
                for j in range(n):
                    if j not in seen:
                        nbit = bit | (1 << j)
                        DP[nbit][j] = min(DP[nbit][j], max(DP[bit][i], A[i][1] - A[i][0] + A[j][0]))
    print(min(DP[-1]))

if __name__ == '__main__':
    main()
0