結果
| 問題 |
No.844 split game
|
| コンテスト | |
| ユーザー |
totori_nyaa
|
| 提出日時 | 2019-08-06 16:29:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 707 bytes |
| コンパイル時間 | 1,588 ms |
| コンパイル使用メモリ | 172,940 KB |
| 実行使用メモリ | 9,344 KB |
| 最終ジャッジ日時 | 2024-07-18 14:05:41 |
| 合計ジャッジ時間 | 4,400 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 WA * 35 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main(){
//cout << setprecision(12) ;
ios::sync_with_stdio(false);
cin.tie(0);
ll n,m,a;
cin>>n>>m>>a;
vector<vector<pair<ll,ll>>> v(111111);
for(ll i=0;i<m;i++){
ll 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=-1e18;
for(ll i=1;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]);
dp[i] = max(dp[i],ans);
}
ans = max(ans,0LL);
cout<<ans<<endl;
}
totori_nyaa