結果

問題 No.844 split game
ユーザー mkawa2mkawa2
提出日時 2021-03-13 16:19:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 38,656 KB
最終ジャッジ日時 2024-04-23 07:28:47
合計ジャッジ時間 22,077 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 268 ms
21,120 KB
testcase_01 AC 215 ms
23,936 KB
testcase_02 AC 705 ms
30,464 KB
testcase_03 AC 389 ms
28,672 KB
testcase_04 AC 206 ms
19,584 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 665 ms
37,248 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 656 ms
36,992 KB
testcase_19 WA -
testcase_20 AC 667 ms
37,248 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 41 ms
11,520 KB
testcase_27 WA -
testcase_28 AC 38 ms
11,648 KB
testcase_29 AC 62 ms
12,800 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 37 ms
11,520 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 330 ms
18,688 KB
testcase_39 AC 581 ms
24,320 KB
testcase_40 AC 126 ms
19,072 KB
testcase_41 AC 31 ms
10,880 KB
testcase_42 AC 30 ms
10,880 KB
testcase_43 AC 30 ms
10,880 KB
testcase_44 AC 31 ms
10,880 KB
testcase_45 WA -
testcase_46 AC 31 ms
10,880 KB
testcase_47 AC 31 ms
10,752 KB
testcase_48 WA -
testcase_49 AC 30 ms
10,880 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 31 ms
10,880 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 31 ms
10,880 KB
testcase_59 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.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 BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# 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**16
# md = 998244353
md = 10**9+7

n,m,a=LI()
to=[[] for _ in range(n)]
ll=[]
for _ in range(m):
    l,r,p=LI()
    l-=1
    ll.append(l)
    to[l].append((r,p-a))

dp=[-a]*(n+1)
dp[0]=0
for l in ll:
    pre=dp[l]
    if pre==-inf:continue
    for r,p in to[l]:
        dp[r]=max(dp[r],dp[l]+p)
dp[-1]+=a

print(max(dp))
0