結果

問題 No.1676 Coin Trade (Single)
ユーザー kohei2019kohei2019
提出日時 2023-06-09 11:27:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 356 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 95,500 KB
最終ジャッジ日時 2023-08-30 07:05:10
合計ジャッジ時間 9,902 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,272 KB
testcase_01 AC 70 ms
71,424 KB
testcase_02 AC 69 ms
71,268 KB
testcase_03 AC 284 ms
90,292 KB
testcase_04 AC 257 ms
88,504 KB
testcase_05 AC 258 ms
89,388 KB
testcase_06 AC 255 ms
88,260 KB
testcase_07 AC 230 ms
87,136 KB
testcase_08 AC 188 ms
83,156 KB
testcase_09 AC 240 ms
88,492 KB
testcase_10 AC 237 ms
86,776 KB
testcase_11 AC 287 ms
90,340 KB
testcase_12 AC 213 ms
85,052 KB
testcase_13 AC 71 ms
71,292 KB
testcase_14 AC 70 ms
71,236 KB
testcase_15 AC 70 ms
71,440 KB
testcase_16 AC 71 ms
71,344 KB
testcase_17 AC 70 ms
71,308 KB
testcase_18 AC 69 ms
71,460 KB
testcase_19 AC 71 ms
71,424 KB
testcase_20 AC 70 ms
71,364 KB
testcase_21 AC 71 ms
71,356 KB
testcase_22 AC 70 ms
71,060 KB
testcase_23 AC 73 ms
71,488 KB
testcase_24 AC 71 ms
71,388 KB
testcase_25 AC 72 ms
71,352 KB
testcase_26 AC 70 ms
71,368 KB
testcase_27 AC 70 ms
71,140 KB
testcase_28 AC 72 ms
71,288 KB
testcase_29 AC 71 ms
71,392 KB
testcase_30 AC 72 ms
71,492 KB
testcase_31 AC 70 ms
71,340 KB
testcase_32 AC 68 ms
71,048 KB
testcase_33 AC 353 ms
95,228 KB
testcase_34 AC 356 ms
95,500 KB
testcase_35 AC 350 ms
93,776 KB
testcase_36 AC 351 ms
93,656 KB
testcase_37 AC 345 ms
95,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
lsA = []
lsg = [[] for i in range(N)]
for i in range(N):
    A,M = map(int,input().split())
    ls = list(map(int,input().split()))
    lsA.append(A)
    for j in range(len(ls)):
        lsg[ls[j]-1].append((i,lsA[i]-lsA[ls[j]-1]))
for i in range(N-1):
    lsg[i].append((i+1,0))

cost = [0]*(N)
for i in range(N):
    c = cost[i]
    for g,v in lsg[i]:
        cost[g] = max(cost[g],c+v)

print(max(cost))
0