結果

問題 No.771 しおり
ユーザー SI1000-githubSI1000-github
提出日時 2022-10-25 23:48:18
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,032 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 181,852 KB
最終ジャッジ日時 2023-09-16 20:16:44
合計ジャッジ時間 30,913 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 324 ms
89,432 KB
testcase_02 AC 73 ms
71,208 KB
testcase_03 AC 76 ms
71,284 KB
testcase_04 AC 74 ms
71,332 KB
testcase_05 AC 76 ms
71,052 KB
testcase_06 AC 75 ms
71,524 KB
testcase_07 AC 76 ms
71,052 KB
testcase_08 AC 112 ms
77,380 KB
testcase_09 AC 76 ms
71,284 KB
testcase_10 AC 77 ms
71,056 KB
testcase_11 AC 77 ms
71,196 KB
testcase_12 AC 75 ms
71,228 KB
testcase_13 AC 74 ms
71,116 KB
testcase_14 AC 118 ms
77,404 KB
testcase_15 AC 76 ms
71,504 KB
testcase_16 AC 79 ms
75,996 KB
testcase_17 AC 100 ms
77,052 KB
testcase_18 AC 73 ms
70,844 KB
testcase_19 AC 82 ms
76,040 KB
testcase_20 AC 75 ms
71,228 KB
testcase_21 AC 75 ms
71,204 KB
testcase_22 AC 81 ms
76,444 KB
testcase_23 AC 87 ms
75,928 KB
testcase_24 AC 97 ms
76,964 KB
testcase_25 AC 1,035 ms
127,792 KB
testcase_26 AC 142 ms
78,612 KB
testcase_27 AC 330 ms
89,268 KB
testcase_28 AC 601 ms
101,880 KB
testcase_29 AC 334 ms
89,460 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 AC 168 ms
80,304 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 172 ms
80,412 KB
testcase_36 AC 129 ms
77,944 KB
testcase_37 AC 129 ms
78,140 KB
testcase_38 AC 174 ms
79,872 KB
testcase_39 AC 134 ms
77,800 KB
testcase_40 AC 1,028 ms
127,760 KB
testcase_41 TLE -
testcase_42 TLE -
testcase_43 AC 323 ms
89,440 KB
testcase_44 TLE -
testcase_45 TLE -
権限があれば一括ダウンロードができます

ソースコード

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 v in range(N):
        if s >> v & 1 == 0:
            now = float("INF")
            for u in range(N):
                if s>>u&1 == 1:
                    now = max(dp[s][u], AB[v][0] + (AB[u][1]-AB[u][0]))
                    dp[s+2**v][v] = min(dp[s+2**v][v], now)


ans = float("INF")

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

print(ans)
0