結果

問題 No.771 しおり
ユーザー SI1000-githubSI1000-github
提出日時 2022-10-26 00:02:35
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,002 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 182,104 KB
最終ジャッジ日時 2023-09-29 13:14:26
合計ジャッジ時間 28,295 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 303 ms
89,720 KB
testcase_02 AC 71 ms
71,128 KB
testcase_03 AC 75 ms
71,524 KB
testcase_04 AC 73 ms
71,456 KB
testcase_05 AC 75 ms
71,096 KB
testcase_06 AC 73 ms
71,140 KB
testcase_07 AC 74 ms
71,436 KB
testcase_08 AC 117 ms
78,024 KB
testcase_09 AC 73 ms
71,332 KB
testcase_10 AC 75 ms
71,272 KB
testcase_11 AC 74 ms
71,524 KB
testcase_12 AC 73 ms
71,536 KB
testcase_13 AC 75 ms
71,252 KB
testcase_14 AC 118 ms
78,040 KB
testcase_15 AC 74 ms
71,356 KB
testcase_16 AC 77 ms
75,636 KB
testcase_17 AC 97 ms
76,840 KB
testcase_18 AC 75 ms
71,356 KB
testcase_19 AC 76 ms
75,724 KB
testcase_20 AC 72 ms
71,436 KB
testcase_21 AC 73 ms
71,428 KB
testcase_22 AC 76 ms
75,836 KB
testcase_23 AC 84 ms
76,576 KB
testcase_24 AC 96 ms
77,180 KB
testcase_25 AC 961 ms
128,524 KB
testcase_26 AC 139 ms
79,112 KB
testcase_27 AC 287 ms
84,880 KB
testcase_28 AC 549 ms
101,780 KB
testcase_29 AC 295 ms
84,896 KB
testcase_30 AC 1,911 ms
182,104 KB
testcase_31 TLE -
testcase_32 AC 158 ms
79,932 KB
testcase_33 AC 1,946 ms
181,676 KB
testcase_34 TLE -
testcase_35 AC 161 ms
79,892 KB
testcase_36 AC 126 ms
78,316 KB
testcase_37 AC 125 ms
78,080 KB
testcase_38 AC 161 ms
81,256 KB
testcase_39 AC 129 ms
78,244 KB
testcase_40 AC 971 ms
128,880 KB
testcase_41 TLE -
testcase_42 AC 1,868 ms
182,068 KB
testcase_43 AC 306 ms
89,808 KB
testcase_44 AC 1,921 ms
181,800 KB
testcase_45 AC 1,899 ms
181,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
# -*- coding: utf-8 -*-

# import
from sys import stdin, setrecursionlimit
setrecursionlimit(10**8)

def int_map():
    return map(int,input().split())

def int_list():
    return list(map(int,input().split()))

def int_mtx(N):
    x = [list(map(int, stdin.readline().split())) for _ in range(N)]
    return x

def str_mtx(N):
    x = [list(stdin.readline()[:-1]) for _ in range(N)]
    return x

def print_space(l):
    return print(" ".join([str(x) for x in l]))



"""    main code    """

N = int(input())
AB = int_mtx(N)

dp = [[float("INF") for _ in range(N)] for _ in range(2**N)]
for u in range(N):
    dp[2**u][u] = 0

from itertools import product

for s in range(2**N):
    for u in range(N):
        if s>>u&1 == 1:
            for v in range(N):
                if s >> v & 1 == 0:
                    dp[s+2**v][v] = min(dp[s+2**v][v], max(dp[s][u], AB[v][0] + (AB[u][1]-AB[u][0])))


ans = float("INF")

for u in range(N):
    ans = min(ans, dp[2**N-1][u])

print(ans)
0