# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101033 | a1_N | Divide and conquer (IZhO14_divide) | C++14 | 1054 ms | 1984 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 int long long
using namespace std;
const int N = (int)1e5 + 55;
int n,a[N],g[N],e[N],ans;
main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i] >> g[i] >> e[i];
}
for(int i = 1; i <= n; i++){
int gold = 0,energy = 0;
for(int j = i; j <= n; j++){
gold += g[j];
energy += e[j];
if(a[j] - a[i] <= energy){
ans = max(ans, gold);
}
}
}
cout << 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... |