結果

問題 No.844 split game
ユーザー kotatsugamekotatsugame
提出日時 2019-06-28 23:21:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 73,368 KB
実行使用メモリ 10,132 KB
最終ジャッジ日時 2023-09-14 22:41:09
合計ジャッジ時間 5,097 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
7,824 KB
testcase_01 AC 33 ms
8,040 KB
testcase_02 AC 88 ms
9,268 KB
testcase_03 AC 62 ms
8,748 KB
testcase_04 AC 33 ms
7,556 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 109 ms
9,884 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 109 ms
9,824 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 5 ms
6,556 KB
testcase_27 WA -
testcase_28 AC 4 ms
6,584 KB
testcase_29 AC 9 ms
6,692 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 4 ms
6,520 KB
testcase_33 AC 11 ms
6,840 KB
testcase_34 AC 7 ms
6,828 KB
testcase_35 AC 12 ms
6,804 KB
testcase_36 AC 8 ms
6,976 KB
testcase_37 AC 18 ms
6,780 KB
testcase_38 AC 31 ms
7,460 KB
testcase_39 AC 61 ms
8,596 KB
testcase_40 AC 20 ms
7,508 KB
testcase_41 AC 3 ms
6,488 KB
testcase_42 AC 3 ms
6,428 KB
testcase_43 AC 3 ms
6,456 KB
testcase_44 AC 3 ms
6,728 KB
testcase_45 AC 3 ms
6,492 KB
testcase_46 AC 3 ms
6,488 KB
testcase_47 WA -
testcase_48 AC 3 ms
6,464 KB
testcase_49 WA -
testcase_50 AC 3 ms
6,480 KB
testcase_51 WA -
testcase_52 AC 3 ms
6,488 KB
testcase_53 AC 3 ms
6,428 KB
testcase_54 WA -
testcase_55 AC 3 ms
6,476 KB
testcase_56 AC 3 ms
6,700 KB
testcase_57 AC 3 ms
6,444 KB
testcase_58 AC 3 ms
6,540 KB
testcase_59 AC 3 ms
6,700 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N,M;
long A;
vector<pair<int,long> >G[1<<17];
long dp[1<<17];
main()
{
	cin>>N>>M>>A;
	for(int i=0;i<M;i++)
	{
		long l,r,p;cin>>l>>r>>p;
		G[l-1].push_back({r,p});
	}
	for(int i=1;i<N;i++)dp[i]=-1e18;
	for(int i=0;i<N;i++)
	{
		if(i)dp[i]=max(dp[i],dp[i-1]-A);
		for(pair<int,long>p:G[i])
		{
			dp[p.first]=max(dp[p.first],dp[i]+p.second-(p.first==N?0:A));
		}
	}
	long ans=0;
	for(int i=0;i<=N;i++)ans=max(ans,dp[i]);
	cout<<ans<<endl;
}
0