結果
| 問題 |
No.844 split game
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2019-06-28 21:44:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 908 bytes |
| コンパイル時間 | 920 ms |
| コンパイル使用メモリ | 101,692 KB |
| 実行使用メモリ | 9,216 KB |
| 最終ジャッジ日時 | 2024-07-02 04:32:06 |
| 合計ジャッジ時間 | 5,272 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 WA * 23 |
ソースコード
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;
int main()
{
int n, m; ll a; cin>>n>>m>>a;
ll dp[100010];
fill(dp, dp+n+1, -a);
dp[0]=0;
vector<P> v[100010];
for(int i=0; i<m; i++){
int l, r; ll p; cin>>l>>r>>p;
v[r].push_back({l, p});
}
ll ans=0;
for(int i=1; i<=n; i++){
for(auto p:v[i]){
dp[i]=max(dp[i], dp[p.first-1]-a+p.second);
}
ans=max(dp[i], ans);
}
ans=max(ans, dp[n]+a);
cout<<ans<<endl;
return 0;
}
chocorusk