結果

問題 No.771 しおり
ユーザー SI1000-githubSI1000-github
提出日時 2022-10-25 23:56:10
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 971 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 182,100 KB
最終ジャッジ日時 2023-09-16 20:22:48
合計ジャッジ時間 27,992 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 291 ms
89,912 KB
testcase_02 AC 68 ms
71,400 KB
testcase_03 AC 67 ms
71,288 KB
testcase_04 AC 69 ms
71,420 KB
testcase_05 AC 69 ms
71,416 KB
testcase_06 AC 67 ms
71,168 KB
testcase_07 AC 69 ms
71,420 KB
testcase_08 AC 107 ms
77,492 KB
testcase_09 AC 69 ms
71,248 KB
testcase_10 AC 68 ms
71,128 KB
testcase_11 AC 72 ms
71,496 KB
testcase_12 AC 69 ms
71,328 KB
testcase_13 AC 69 ms
71,284 KB
testcase_14 AC 113 ms
77,772 KB
testcase_15 AC 70 ms
71,424 KB
testcase_16 AC 73 ms
75,664 KB
testcase_17 AC 92 ms
77,024 KB
testcase_18 AC 69 ms
71,348 KB
testcase_19 AC 73 ms
75,716 KB
testcase_20 AC 69 ms
71,112 KB
testcase_21 AC 70 ms
71,376 KB
testcase_22 AC 74 ms
75,704 KB
testcase_23 AC 81 ms
76,412 KB
testcase_24 AC 92 ms
76,680 KB
testcase_25 AC 934 ms
128,476 KB
testcase_26 AC 131 ms
78,936 KB
testcase_27 AC 276 ms
84,596 KB
testcase_28 AC 536 ms
101,588 KB
testcase_29 AC 285 ms
84,656 KB
testcase_30 AC 1,878 ms
181,968 KB
testcase_31 AC 1,992 ms
181,704 KB
testcase_32 AC 145 ms
79,556 KB
testcase_33 AC 1,888 ms
182,024 KB
testcase_34 AC 1,947 ms
181,520 KB
testcase_35 AC 151 ms
79,688 KB
testcase_36 AC 119 ms
78,160 KB
testcase_37 AC 118 ms
77,964 KB
testcase_38 AC 152 ms
80,908 KB
testcase_39 AC 124 ms
78,108 KB
testcase_40 AC 953 ms
128,508 KB
testcase_41 TLE -
testcase_42 AC 1,848 ms
181,672 KB
testcase_43 AC 296 ms
89,592 KB
testcase_44 AC 1,905 ms
181,824 KB
testcase_45 AC 1,869 ms
181,484 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

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