結果
| 問題 |
No.974 最後の日までに
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2019-12-06 23:38:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 1,458 ms |
| コンパイル使用メモリ | 168,404 KB |
| 実行使用メモリ | 17,080 KB |
| 最終ジャッジ日時 | 2024-06-25 16:03:36 |
| 合計ジャッジ時間 | 7,918 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 48 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000
long long ans = 0;
void dfs1(vector<long long> &a,vector<long long> &b,vector<long long> &c,int ind,long long love,long long money){
int n = a.size();
if(ind==n){
if(money>=0){
ans = max(love,ans);
}
return;
}
else if(ind==n+1){
return;
}
dfs1(a,b,c,ind+1,love,money+a[ind]);
if(ind!=n-1)dfs1(a,b,c,ind+2,love+b[ind+1],money-c[ind+1]);
else dfs1(a,b,c,ind+2,love,money);
}
int main(){
int D;
cin>>D;
vector<long long> a(D),b(D),c(D);
for(int i=0;i<D;i++){
cin>>a[i]>>b[i]>>c[i];
}
dfs1(a,b,c,0,0,0);
cout<<ans<<endl;
return 0;
}
沙耶花