結果

問題 No.1676 Coin Trade (Single)
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-09-10 22:19:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 565 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 86,336 KB
実行使用メモリ 92,548 KB
最終ジャッジ日時 2023-09-02 18:21:04
合計ジャッジ時間 6,527 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,132 KB
testcase_01 AC 76 ms
71,148 KB
testcase_02 AC 76 ms
71,132 KB
testcase_03 AC 173 ms
87,684 KB
testcase_04 AC 161 ms
84,736 KB
testcase_05 AC 153 ms
84,872 KB
testcase_06 AC 156 ms
84,732 KB
testcase_07 AC 142 ms
82,616 KB
testcase_08 AC 121 ms
79,320 KB
testcase_09 AC 145 ms
82,372 KB
testcase_10 AC 146 ms
82,748 KB
testcase_11 AC 179 ms
87,308 KB
testcase_12 AC 131 ms
80,504 KB
testcase_13 AC 77 ms
71,136 KB
testcase_14 AC 76 ms
71,304 KB
testcase_15 AC 75 ms
71,236 KB
testcase_16 AC 77 ms
71,208 KB
testcase_17 AC 77 ms
71,148 KB
testcase_18 AC 79 ms
70,960 KB
testcase_19 AC 76 ms
71,412 KB
testcase_20 AC 78 ms
71,160 KB
testcase_21 AC 76 ms
71,140 KB
testcase_22 AC 81 ms
71,036 KB
testcase_23 AC 82 ms
71,212 KB
testcase_24 AC 78 ms
71,312 KB
testcase_25 AC 75 ms
70,928 KB
testcase_26 AC 77 ms
71,368 KB
testcase_27 AC 76 ms
71,208 KB
testcase_28 AC 77 ms
71,264 KB
testcase_29 AC 78 ms
70,956 KB
testcase_30 AC 79 ms
71,028 KB
testcase_31 AC 78 ms
71,092 KB
testcase_32 AC 76 ms
71,084 KB
testcase_33 AC 198 ms
91,724 KB
testcase_34 AC 199 ms
91,520 KB
testcase_35 AC 200 ms
92,548 KB
testcase_36 AC 197 ms
91,768 KB
testcase_37 AC 205 ms
91,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

1676 & 8

flowかねぇ


"""

import sys
from sys import stdin
import heapq

N,K = map(int,stdin.readline().split())

A = []
B = []

for i in range(N):

    a,m = map(int,stdin.readline().split())
    b = list(map(int,stdin.readline().split()))

    for j in range(m):
        b[j] -= 1

    A.append(a)
    B.append(b)

if K == 1: #1676

    dp = [0] * N

    for i in range(N):

        if i != 0:
            dp[i] = max(dp[i] , dp[i-1])
        
        for v in B[i]:
            dp[i] = max(dp[i] , dp[v] + A[i] - A[v])

    print (dp[-1])
            
0