結果

問題 No.1676 Coin Trade (Single)
ユーザー roarisroaris
提出日時 2022-11-26 16:37:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 77,000 KB
最終ジャッジ日時 2024-04-14 03:38:42
合計ジャッジ時間 4,703 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,332 KB
testcase_01 AC 40 ms
53,308 KB
testcase_02 AC 38 ms
52,272 KB
testcase_03 AC 108 ms
76,664 KB
testcase_04 AC 100 ms
76,332 KB
testcase_05 AC 94 ms
76,436 KB
testcase_06 AC 95 ms
76,548 KB
testcase_07 AC 86 ms
76,148 KB
testcase_08 AC 80 ms
76,480 KB
testcase_09 AC 89 ms
76,456 KB
testcase_10 AC 90 ms
76,216 KB
testcase_11 AC 108 ms
76,364 KB
testcase_12 AC 82 ms
76,276 KB
testcase_13 AC 38 ms
53,348 KB
testcase_14 AC 37 ms
53,012 KB
testcase_15 AC 37 ms
51,968 KB
testcase_16 AC 39 ms
53,012 KB
testcase_17 AC 38 ms
52,404 KB
testcase_18 AC 37 ms
52,288 KB
testcase_19 AC 38 ms
52,744 KB
testcase_20 AC 38 ms
52,272 KB
testcase_21 AC 38 ms
53,068 KB
testcase_22 AC 37 ms
52,444 KB
testcase_23 AC 37 ms
52,696 KB
testcase_24 AC 37 ms
52,276 KB
testcase_25 AC 37 ms
52,624 KB
testcase_26 AC 37 ms
53,008 KB
testcase_27 AC 38 ms
52,452 KB
testcase_28 AC 37 ms
52,692 KB
testcase_29 AC 38 ms
52,448 KB
testcase_30 AC 37 ms
52,332 KB
testcase_31 AC 37 ms
52,836 KB
testcase_32 AC 37 ms
52,444 KB
testcase_33 AC 118 ms
76,568 KB
testcase_34 AC 118 ms
77,000 KB
testcase_35 AC 119 ms
76,548 KB
testcase_36 AC 118 ms
76,632 KB
testcase_37 AC 118 ms
76,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
dp = [-10**18]*(N+1)
dp[0] = 0

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

print(dp[0])
0