結果

問題 No.1676 Coin Trade (Single)
ユーザー chineristACchineristAC
提出日時 2021-09-10 21:57:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 86,764 KB
実行使用メモリ 87,992 KB
最終ジャッジ日時 2023-09-02 17:21:19
合計ジャッジ時間 7,545 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,956 KB
testcase_01 AC 94 ms
71,920 KB
testcase_02 AC 94 ms
71,980 KB
testcase_03 AC 215 ms
84,948 KB
testcase_04 AC 200 ms
83,932 KB
testcase_05 AC 199 ms
83,716 KB
testcase_06 AC 203 ms
83,424 KB
testcase_07 AC 184 ms
82,184 KB
testcase_08 AC 154 ms
79,360 KB
testcase_09 AC 182 ms
82,628 KB
testcase_10 AC 197 ms
82,664 KB
testcase_11 AC 221 ms
84,884 KB
testcase_12 AC 175 ms
81,060 KB
testcase_13 AC 93 ms
71,852 KB
testcase_14 AC 94 ms
71,924 KB
testcase_15 AC 96 ms
71,716 KB
testcase_16 AC 96 ms
71,872 KB
testcase_17 AC 95 ms
71,916 KB
testcase_18 AC 95 ms
71,884 KB
testcase_19 AC 94 ms
72,204 KB
testcase_20 AC 97 ms
71,720 KB
testcase_21 AC 97 ms
71,880 KB
testcase_22 AC 97 ms
71,764 KB
testcase_23 AC 95 ms
71,908 KB
testcase_24 AC 96 ms
71,828 KB
testcase_25 AC 96 ms
71,700 KB
testcase_26 AC 97 ms
71,828 KB
testcase_27 AC 95 ms
71,892 KB
testcase_28 AC 94 ms
71,900 KB
testcase_29 AC 92 ms
72,052 KB
testcase_30 AC 94 ms
71,876 KB
testcase_31 AC 94 ms
71,880 KB
testcase_32 AC 93 ms
71,732 KB
testcase_33 AC 249 ms
87,164 KB
testcase_34 AC 260 ms
87,992 KB
testcase_35 AC 244 ms
87,356 KB
testcase_36 AC 246 ms
87,352 KB
testcase_37 AC 259 ms
87,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random

#sys.setrecursionlimit(2*10**5)

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,K = mi()
A = [0 for i in range(N)]
edge = [[] for i in range(N)]
for i in range(N):
    A[i],M = mi()
    B = li()
    for pi in B:
        edge[pi-1].append(i)

dp = [0 for i in range(N)]
for i in range(N-2,-1,-1):
    dp[i] = dp[i+1]
    for nv in edge[i]:
        tmp = A[nv]-A[i] + dp[nv]
        dp[i] = max(tmp,dp[i])

print(dp[0])
0