結果

問題 No.1676 Coin Trade (Single)
ユーザー convexineqconvexineq
提出日時 2021-09-10 21:56:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 88,464 KB
最終ジャッジ日時 2023-09-02 17:16:02
合計ジャッジ時間 8,176 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,904 KB
testcase_01 AC 73 ms
71,288 KB
testcase_02 AC 72 ms
71,072 KB
testcase_03 AC 269 ms
85,380 KB
testcase_04 AC 238 ms
84,368 KB
testcase_05 AC 234 ms
84,308 KB
testcase_06 AC 258 ms
84,404 KB
testcase_07 AC 228 ms
83,340 KB
testcase_08 AC 187 ms
80,648 KB
testcase_09 AC 216 ms
83,128 KB
testcase_10 AC 225 ms
83,488 KB
testcase_11 AC 286 ms
85,168 KB
testcase_12 AC 214 ms
82,248 KB
testcase_13 AC 74 ms
71,272 KB
testcase_14 AC 72 ms
71,164 KB
testcase_15 AC 73 ms
71,028 KB
testcase_16 AC 77 ms
71,304 KB
testcase_17 AC 78 ms
71,128 KB
testcase_18 AC 77 ms
70,908 KB
testcase_19 AC 76 ms
71,176 KB
testcase_20 AC 77 ms
71,348 KB
testcase_21 AC 77 ms
71,180 KB
testcase_22 AC 77 ms
71,036 KB
testcase_23 AC 72 ms
71,140 KB
testcase_24 AC 74 ms
71,320 KB
testcase_25 AC 72 ms
71,064 KB
testcase_26 AC 73 ms
71,320 KB
testcase_27 AC 71 ms
71,196 KB
testcase_28 AC 72 ms
70,916 KB
testcase_29 AC 72 ms
71,064 KB
testcase_30 AC 73 ms
71,012 KB
testcase_31 AC 73 ms
71,220 KB
testcase_32 AC 73 ms
71,024 KB
testcase_33 AC 311 ms
88,464 KB
testcase_34 AC 313 ms
88,304 KB
testcase_35 AC 301 ms
87,640 KB
testcase_36 AC 302 ms
88,172 KB
testcase_37 AC 305 ms
88,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
dp = [0]*n
a = [0]*n
g = [[] for _ in range(n)]

for i in range(n):
    a[i],_ = map(int,input().split())
    *b, = map(int,input().split())
    for bi in b:
        bi -= 1
        if bi < i: g[bi].append(i)

for i in range(n):
    if i: dp[i] = max(dp[i],dp[i-1])
    for v in g[i]:
        dp[v] = max(dp[v],dp[i]-a[i]+a[v])
print(dp[-1])
0