結果

問題 No.1676 Coin Trade (Single)
ユーザー puznekopuzneko
提出日時 2021-11-07 00:41:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 82,204 KB
実行使用メモリ 135,908 KB
最終ジャッジ日時 2024-04-25 13:07:03
合計ジャッジ時間 6,891 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,840 KB
testcase_01 AC 35 ms
51,952 KB
testcase_02 AC 35 ms
53,020 KB
testcase_03 AC 119 ms
118,072 KB
testcase_04 AC 110 ms
117,300 KB
testcase_05 AC 105 ms
112,624 KB
testcase_06 AC 104 ms
112,756 KB
testcase_07 AC 99 ms
108,024 KB
testcase_08 AC 76 ms
94,116 KB
testcase_09 AC 98 ms
107,724 KB
testcase_10 AC 97 ms
108,252 KB
testcase_11 AC 118 ms
122,512 KB
testcase_12 AC 84 ms
99,780 KB
testcase_13 AC 35 ms
52,452 KB
testcase_14 AC 35 ms
52,068 KB
testcase_15 AC 36 ms
52,516 KB
testcase_16 AC 35 ms
53,248 KB
testcase_17 AC 36 ms
52,496 KB
testcase_18 AC 36 ms
52,800 KB
testcase_19 AC 36 ms
53,372 KB
testcase_20 AC 35 ms
53,216 KB
testcase_21 AC 35 ms
54,100 KB
testcase_22 AC 35 ms
52,200 KB
testcase_23 AC 37 ms
53,108 KB
testcase_24 AC 35 ms
52,236 KB
testcase_25 AC 36 ms
53,040 KB
testcase_26 AC 36 ms
53,224 KB
testcase_27 AC 36 ms
52,880 KB
testcase_28 AC 37 ms
52,568 KB
testcase_29 AC 35 ms
53,072 KB
testcase_30 AC 37 ms
53,536 KB
testcase_31 AC 35 ms
52,724 KB
testcase_32 AC 36 ms
52,768 KB
testcase_33 AC 148 ms
135,884 KB
testcase_34 AC 146 ms
135,880 KB
testcase_35 AC 145 ms
135,892 KB
testcase_36 AC 147 ms
135,732 KB
testcase_37 AC 145 ms
135,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
n, m, *indata = map(int, stdin.read().split())
offset = 0
pricetable = [0 for i in range(n+1)]
dp = [0 for i in range(n+1)]
for i in range(n):
    a, m = indata[offset],indata[offset + 1]
    offset += 2
    dp[i+1] = dp[i]
    for j in range(m):
        b = indata[offset + j]
        dp[i+1] = max(dp[i+1],dp[b]-pricetable[b]+a)
    pricetable[i+1] = a
    offset += m
print("{}".format(dp[n]))
0