結果

問題 No.844 split game
ユーザー tempura_pptempura_pp
提出日時 2019-03-14 01:01:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 706 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 35,308 KB
最終ジャッジ日時 2023-09-06 23:27:21
合計ジャッジ時間 15,843 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 256 ms
18,592 KB
testcase_01 AC 264 ms
23,384 KB
testcase_02 AC 557 ms
26,760 KB
testcase_03 AC 434 ms
26,900 KB
testcase_04 AC 203 ms
17,148 KB
testcase_05 AC 584 ms
31,112 KB
testcase_06 AC 179 ms
16,464 KB
testcase_07 AC 190 ms
20,032 KB
testcase_08 AC 98 ms
13,132 KB
testcase_09 AC 396 ms
20,956 KB
testcase_10 AC 608 ms
30,500 KB
testcase_11 AC 647 ms
33,360 KB
testcase_12 AC 386 ms
20,488 KB
testcase_13 AC 239 ms
16,184 KB
testcase_14 AC 286 ms
21,516 KB
testcase_15 AC 706 ms
35,236 KB
testcase_16 AC 698 ms
35,132 KB
testcase_17 AC 686 ms
35,276 KB
testcase_18 AC 696 ms
35,268 KB
testcase_19 AC 699 ms
35,308 KB
testcase_20 AC 685 ms
35,200 KB
testcase_21 AC 682 ms
35,256 KB
testcase_22 AC 693 ms
35,296 KB
testcase_23 AC 34 ms
9,272 KB
testcase_24 AC 60 ms
10,528 KB
testcase_25 AC 38 ms
8,816 KB
testcase_26 AC 29 ms
9,048 KB
testcase_27 AC 48 ms
9,320 KB
testcase_28 AC 27 ms
9,296 KB
testcase_29 AC 53 ms
10,396 KB
testcase_30 AC 58 ms
10,516 KB
testcase_31 AC 50 ms
9,792 KB
testcase_32 AC 26 ms
9,036 KB
testcase_33 AC 63 ms
9,648 KB
testcase_34 AC 42 ms
8,868 KB
testcase_35 AC 72 ms
9,832 KB
testcase_36 AC 49 ms
9,184 KB
testcase_37 AC 101 ms
10,752 KB
testcase_38 AC 197 ms
14,028 KB
testcase_39 AC 418 ms
19,668 KB
testcase_40 AC 161 ms
16,936 KB
testcase_41 AC 16 ms
7,824 KB
testcase_42 AC 15 ms
7,968 KB
testcase_43 AC 16 ms
7,972 KB
testcase_44 AC 16 ms
7,848 KB
testcase_45 AC 16 ms
7,884 KB
testcase_46 AC 16 ms
7,820 KB
testcase_47 AC 16 ms
7,852 KB
testcase_48 AC 15 ms
7,864 KB
testcase_49 AC 16 ms
7,840 KB
testcase_50 AC 16 ms
7,968 KB
testcase_51 AC 16 ms
7,944 KB
testcase_52 AC 15 ms
7,820 KB
testcase_53 AC 15 ms
7,908 KB
testcase_54 AC 15 ms
7,992 KB
testcase_55 AC 16 ms
7,980 KB
testcase_56 AC 15 ms
7,932 KB
testcase_57 AC 16 ms
7,800 KB
testcase_58 AC 16 ms
7,916 KB
testcase_59 AC 16 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,a=map(int,input().split())
dp = [0]*(n+1)
edge = [[] for i in range(n)]
for i in range(m) :
    x,y,z=map(int,input().split())
    edge[y-1].append([x-1,z])
ans = 0
for i in range(n) :
    dp[i+1] = ans - a
    for p in edge[i] :
        dp[i+1] = max(dp[i+1], dp[p[0]]+p[1]-(a if i != n-1 else 0))
    ans = max(ans, dp[i+1])
print(ans)
0