結果

問題 No.771 しおり
ユーザー SI1000-githubSI1000-github
提出日時 2022-10-25 20:52:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 918 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 133,688 KB
最終ジャッジ日時 2023-09-16 18:03:50
合計ジャッジ時間 22,243 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 67 ms
71,140 KB
testcase_03 AC 66 ms
71,200 KB
testcase_04 AC 68 ms
71,412 KB
testcase_05 WA -
testcase_06 AC 68 ms
71,316 KB
testcase_07 AC 67 ms
71,448 KB
testcase_08 WA -
testcase_09 AC 65 ms
71,376 KB
testcase_10 AC 67 ms
71,216 KB
testcase_11 AC 64 ms
71,380 KB
testcase_12 AC 66 ms
71,368 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 1,488 ms
133,380 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 = [[0 for _ in range(N)] for _ in range(2**N)]

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

ans = float("INF")

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

print(ans)
0