結果

問題 No.1676 Coin Trade (Single)
ユーザー tktk_snsn
提出日時 2021-09-10 23:03:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2024-06-12 03:16:16
合計ジャッジ時間 5,354 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
dp = [-10 ** 9] * (N + 1)
dp[0] = 0
for i in range(1, N+1):
    A, M = map(int, input().split())
    B = list(map(int, input().split()))
    dp[i] = dp[0] - A

    res = dp[0]
    for b in B:
        res = max(res, A + dp[b])
    dp[0] = res

print(dp[0])
0