| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1277770 | alahunovahmad | Divide and conquer (IZhO14_divide) | C++20 | 1094 ms | 1344 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n;
cin>>n;
vector<int>x(n),g(n),d(n);
for(int i=0;i<n;i++){
cin>>x[i]>>g[i]>>d[i];
}
int mx=-INT_MAX;
for(int i=0;i<n;i++){
int now=0;
int sum=0;
for(int j=i;j<n;j++){
now+=d[j];
sum+=g[j];
if(x[j]-x[i]<=now){
// cout<<x[j]<<' '<<x[i]<<" energy = "<<now<<" sum = "<<sum<<"\n";
mx=max(mx,sum);
}
}
}
cout<<mx;
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
