結果

問題 No.844 split game
ユーザー kotatsugamekotatsugame
提出日時 2019-06-28 23:27:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 73,912 KB
実行使用メモリ 9,972 KB
最終ジャッジ日時 2023-09-14 22:45:46
合計ジャッジ時間 5,065 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
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 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 11 ms
6,784 KB
testcase_34 AC 8 ms
6,636 KB
testcase_35 AC 13 ms
6,816 KB
testcase_36 AC 9 ms
6,700 KB
testcase_37 AC 18 ms
6,980 KB
testcase_38 AC 30 ms
7,596 KB
testcase_39 AC 62 ms
8,596 KB
testcase_40 AC 20 ms
7,512 KB
testcase_41 AC 3 ms
6,708 KB
testcase_42 AC 3 ms
6,468 KB
testcase_43 WA -
testcase_44 AC 3 ms
6,432 KB
testcase_45 AC 3 ms
6,424 KB
testcase_46 AC 3 ms
6,468 KB
testcase_47 WA -
testcase_48 AC 3 ms
6,420 KB
testcase_49 WA -
testcase_50 AC 3 ms
6,496 KB
testcase_51 WA -
testcase_52 AC 3 ms
6,424 KB
testcase_53 AC 3 ms
6,692 KB
testcase_54 WA -
testcase_55 AC 3 ms
6,432 KB
testcase_56 AC 3 ms
6,508 KB
testcase_57 AC 3 ms
6,432 KB
testcase_58 AC 3 ms
6,692 KB
testcase_59 AC 3 ms
6,468 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-A);
		}
	}
	long ans=0;
	for(int i=0;i<=N;i++)ans=max(ans,dp[i]+A*(i==N));
	cout<<ans<<endl;
}
0