Submission #765587

#TimeUsernameProblemLanguageResultExecution timeMemory
765587edfearay11Divide and conquer (IZhO14_divide)C++17
48 / 100
1089 ms1520 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...