結果

問題 No.1676 Coin Trade (Single)
ユーザー 👑 rin204rin204
提出日時 2021-09-18 11:08:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 80,208 KB
最終ジャッジ日時 2023-09-12 20:43:35
合計ジャッジ時間 8,745 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,440 KB
testcase_01 AC 73 ms
71,316 KB
testcase_02 AC 72 ms
71,028 KB
testcase_03 AC 211 ms
79,408 KB
testcase_04 AC 192 ms
79,476 KB
testcase_05 AC 183 ms
79,304 KB
testcase_06 AC 187 ms
79,548 KB
testcase_07 AC 173 ms
79,240 KB
testcase_08 AC 152 ms
78,948 KB
testcase_09 AC 171 ms
79,296 KB
testcase_10 AC 177 ms
79,012 KB
testcase_11 AC 212 ms
79,676 KB
testcase_12 AC 162 ms
79,216 KB
testcase_13 AC 72 ms
71,236 KB
testcase_14 AC 71 ms
71,328 KB
testcase_15 AC 73 ms
71,028 KB
testcase_16 AC 73 ms
70,976 KB
testcase_17 AC 71 ms
71,108 KB
testcase_18 AC 72 ms
71,172 KB
testcase_19 AC 73 ms
71,320 KB
testcase_20 AC 72 ms
71,116 KB
testcase_21 AC 73 ms
71,172 KB
testcase_22 AC 73 ms
70,976 KB
testcase_23 AC 74 ms
71,088 KB
testcase_24 AC 73 ms
71,260 KB
testcase_25 AC 72 ms
71,296 KB
testcase_26 AC 73 ms
70,832 KB
testcase_27 AC 72 ms
71,292 KB
testcase_28 AC 71 ms
71,276 KB
testcase_29 AC 72 ms
70,972 KB
testcase_30 AC 73 ms
71,052 KB
testcase_31 AC 71 ms
71,356 KB
testcase_32 AC 72 ms
71,244 KB
testcase_33 AC 232 ms
80,124 KB
testcase_34 AC 234 ms
80,068 KB
testcase_35 AC 231 ms
80,180 KB
testcase_36 AC 235 ms
80,208 KB
testcase_37 AC 231 ms
80,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
inf = 10 ** 20
dp = [0] * (n + 1)
alst = [0] * (n + 1)
for i in range(1, n + 1):
    a, m = map(int, input().split())
    alst[i] = a
    blst = list(map(int, input().split()))
    dp[i] = dp[i - 1]
    for b in blst:
        dp[i] = max(dp[i], dp[b] + a - alst[b])

print(dp[-1])
0