結果
問題 |
No.844 split game
|
ユーザー |
![]() |
提出日時 | 2019-08-06 16:17:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 648 bytes |
コンパイル時間 | 1,722 ms |
コンパイル使用メモリ | 173,260 KB |
実行使用メモリ | 8,576 KB |
最終ジャッジ日時 | 2024-07-18 14:05:26 |
合計ジャッジ時間 | 5,623 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 WA * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; signed main(){ //cout << setprecision(12) ; ios::sync_with_stdio(false); cin.tie(0); int n,m,a; cin>>n>>m>>a; vector<vector<pair<int,int>>> v(111111); for(int i=0;i<m;i++){ int l,r,c; cin>>l>>r>>c; l--; v[r].push_back(make_pair(l,c)); } vector<ll> dp(n+1,-a); dp[0]=0,dp[n]=0; ll ans=0; for(int i=0;i<=n;i++){ ll ret=0; for(auto j:v[i]){ ret = max(ret,dp[j.first]+j.second); } dp[i] += ret; ans = max(ans,dp[i]); } cout<<ans<<endl; }