# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
90528 | RAkhshon | Divide and conquer (IZhO14_divide) | C++14 | 1080 ms | 2556 KiB |
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>
#define ll long long
using namespace std;
ll x[101101], g[101010], d[101101], s[101010], a[101101];
int main(){
ll n;
scanf("%lld", &n);
for(ll i = 1; i <= n; i++){
scanf("%lld %lld %lld", &x[i], &g[i], &d[i]);
s[i]=s[i-1]+g[i];
a[i]=a[i-1]+d[i];
}
ll ans = 0;
for(ll i = 1; i <= n; i ++){
for(ll j = i; j <= n; j ++){
ll l = i, r = j;
if(x[r]-x[l] <= a[r]-a[l-1]) ans=max(ans,s[r] - s[l-1]);
}
}
printf("%lld", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |