| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 272093 | Halit | Art Exhibition (JOI18_art) | C++17 | 0 ms | 256 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 max(xx,yy) (xx > yy ? xx : yy)
#define min(xx,yy) (xx > yy ? yy : xx)
#define all(x) x.begin(), x.end()
using namespace std;
int main(){	
	int n;
	scanf("%d", &n);
	
	vector< pair<long long, long long> > v;
	for(int i = 0;i < n;++i){
		long long a,b;
		scanf("%lld %lld", &a, &b);
		v.emplace_back(a,b);
	}
	sort(all(v));
	
	long long sum = 0, j = 0, ans = 0;
	for(int i = 0;i < n;++i){
		sum += v[i].second;
		if(sum - (v[i].first - v[j].first) < 0){
			j = i;
			sum = 0;
		}	else{
			ans = max(ans,sum - (v[i].first - v[j].first));
		}	
	}
	printf("%lld", ans);
}
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... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
