結果

問題 No.1676 Coin Trade (Single)
ユーザー mkawa2mkawa2
提出日時 2021-09-10 22:16:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 839 bytes
コンパイル時間 1,392 ms
コンパイル使用メモリ 86,316 KB
実行使用メモリ 79,320 KB
最終ジャッジ日時 2023-09-02 18:13:50
合計ジャッジ時間 6,410 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,180 KB
testcase_01 AC 73 ms
71,108 KB
testcase_02 AC 74 ms
70,968 KB
testcase_03 AC 188 ms
78,076 KB
testcase_04 AC 154 ms
78,484 KB
testcase_05 AC 139 ms
78,036 KB
testcase_06 AC 149 ms
78,368 KB
testcase_07 AC 139 ms
78,072 KB
testcase_08 AC 121 ms
77,424 KB
testcase_09 AC 137 ms
78,040 KB
testcase_10 AC 140 ms
78,152 KB
testcase_11 AC 177 ms
78,752 KB
testcase_12 AC 123 ms
77,624 KB
testcase_13 AC 73 ms
71,192 KB
testcase_14 AC 73 ms
71,296 KB
testcase_15 AC 73 ms
71,076 KB
testcase_16 AC 74 ms
70,988 KB
testcase_17 AC 74 ms
71,108 KB
testcase_18 AC 75 ms
71,216 KB
testcase_19 AC 76 ms
71,184 KB
testcase_20 AC 74 ms
71,144 KB
testcase_21 AC 72 ms
71,176 KB
testcase_22 AC 75 ms
70,916 KB
testcase_23 AC 75 ms
70,992 KB
testcase_24 AC 75 ms
71,184 KB
testcase_25 AC 74 ms
71,272 KB
testcase_26 AC 75 ms
71,120 KB
testcase_27 AC 74 ms
70,780 KB
testcase_28 AC 73 ms
70,928 KB
testcase_29 AC 75 ms
71,152 KB
testcase_30 AC 75 ms
71,196 KB
testcase_31 AC 73 ms
71,136 KB
testcase_32 AC 73 ms
71,220 KB
testcase_33 AC 179 ms
79,064 KB
testcase_34 AC 176 ms
79,156 KB
testcase_35 AC 178 ms
79,084 KB
testcase_36 AC 179 ms
78,948 KB
testcase_37 AC 183 ms
79,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**20
md = 998244353
# md = 10**9+7

n, k = LI()
dp = [0]+[-inf]*n
aa = [0]*n

for i in range(n):
    a, m = LI()
    bb = LI1()
    aa[i] = a
    dp[i+1] = dp[i]
    for b in bb:
        cur = dp[b+1]+a-aa[b]
        if cur>dp[i+1]:dp[i+1]=cur

print(dp[-1])
0