This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<b;i++)
#define af(i,a,b) for(int i=a;i>=b;i--)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int maxN=1e5+5;
const ll inf=1e12;
void go(){
ll n;
cin>>n;
vector<ll> v1,v2,v3;
ll a,b,c;
f(i,0,n){
cin>>a>>b>>c;
v1.PB(a);
v2.PB(b);
v3.PB(c);
}
ll g=0;
f(i,0,n){
ll en=0;
ll ini=i;
ll gl=0;
f(j,i,n){
en+=v3[j];
gl+=v2[j];
if(v1[j]-v1[i]<=en && gl>g) g=gl;
}
}
cout<<g<<"\n";
}
int main(){
//fastio;
int test=1;
//cin>>test;
f(i,1,test+1){
//cout<<"Case "<<i<<":\n";
go();
}
return 0;
}
Compilation message (stderr)
divide.cpp: In function 'void go()':
divide.cpp:36:6: warning: unused variable 'ini' [-Wunused-variable]
36 | ll ini=i;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |