結果

問題 No.771 しおり
ユーザー rlangevinrlangevin
提出日時 2023-02-02 08:58:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,602 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 1,429 ms
コンパイル使用メモリ 86,504 KB
実行使用メモリ 133,656 KB
最終ジャッジ日時 2023-09-14 16:38:25
合計ジャッジ時間 23,930 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,602 ms
133,656 KB
testcase_01 AC 229 ms
83,200 KB
testcase_02 AC 73 ms
70,976 KB
testcase_03 AC 75 ms
71,008 KB
testcase_04 AC 73 ms
70,968 KB
testcase_05 AC 72 ms
71,100 KB
testcase_06 AC 73 ms
71,000 KB
testcase_07 AC 75 ms
70,992 KB
testcase_08 AC 95 ms
76,316 KB
testcase_09 AC 72 ms
70,748 KB
testcase_10 AC 73 ms
70,972 KB
testcase_11 AC 78 ms
70,736 KB
testcase_12 AC 76 ms
71,040 KB
testcase_13 AC 74 ms
70,968 KB
testcase_14 AC 92 ms
76,024 KB
testcase_15 AC 72 ms
71,032 KB
testcase_16 AC 80 ms
75,784 KB
testcase_17 AC 89 ms
76,268 KB
testcase_18 AC 72 ms
71,080 KB
testcase_19 AC 79 ms
75,648 KB
testcase_20 AC 74 ms
70,736 KB
testcase_21 AC 74 ms
71,092 KB
testcase_22 AC 78 ms
75,348 KB
testcase_23 AC 85 ms
75,920 KB
testcase_24 AC 90 ms
76,316 KB
testcase_25 AC 725 ms
104,788 KB
testcase_26 AC 104 ms
76,380 KB
testcase_27 AC 234 ms
83,264 KB
testcase_28 AC 514 ms
90,380 KB
testcase_29 AC 220 ms
83,388 KB
testcase_30 AC 1,564 ms
133,300 KB
testcase_31 AC 1,595 ms
133,484 KB
testcase_32 AC 130 ms
78,088 KB
testcase_33 AC 1,507 ms
133,608 KB
testcase_34 AC 1,533 ms
133,384 KB
testcase_35 AC 133 ms
78,492 KB
testcase_36 AC 98 ms
76,220 KB
testcase_37 AC 101 ms
76,148 KB
testcase_38 AC 130 ms
78,216 KB
testcase_39 AC 101 ms
76,608 KB
testcase_40 AC 753 ms
104,700 KB
testcase_41 AC 1,487 ms
133,596 KB
testcase_42 AC 1,506 ms
133,308 KB
testcase_43 AC 221 ms
83,576 KB
testcase_44 AC 1,544 ms
133,440 KB
testcase_45 AC 1,500 ms
133,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A, B = [None] * N, [None] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

N2 = 1 << N
inf = 10 ** 18
dp = [[inf] * N for i in range(N2)]
for i in range(N):
    dp[1 << i][i] = 0

for s in range(1, N2):
    for i in range(N):
        for j in range(N):
            if (s >> j) & 1 or (s >> i) & 1 == 0:
                continue
            ns = s | (1 << j)
            dp[ns][j] = min(dp[ns][j], max(dp[s][i], B[i] - A[i] + A[j]))
print(min(dp[-1]))
0