| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 344611 | Erzhan06 | Divide and conquer (IZhO14_divide) | C++17 | 2 ms | 364 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>
using namespace std;
#define nl "\n"
#define bananas return 0;
#define ll long long
#define IOS ios_base :: sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
const int N=2e5+6;
const int INF=1e9+6;
int x[5002],g[5002],e[5002];
int main() {
freopen("divide.in", "r", stdin);
freopen("divide.out", "w", stdout);
IOS
	int n;
	cin>>n;
	for (int i=1;i<=n;i++) {
		cin>>x[i]>>g[i]>>e[i];
	}
	int mx=-1;
	for(int i=1;i<=n;i++) {
		int energy=0;
		int point=0;
		int gold=0;
		int distanse=x[i];
		for (int j=i;j<=n;j++) {
			energy+=e[j];
			point+=x[j]-distanse;
			distanse=x[j];
			if (energy>=point) {
				gold+=g[j];
				mx=max(gold,mx);
			}else {
				break;
			}
		}
	}
	cout<<mx;
bananas
}
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... | ||||
