Submission #913864

# Submission time Handle Problem Language Result Execution time Memory
913864 2024-01-20T11:16:25 Z lukameladze Art Exhibition (JOI18_art) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
int s[500001];
int main(){
	int n, ans = 0,maxx = 0; cin >> n;
	pair<int, int> p[n+1];
	s[0] = 0;
	for(int i = 1; i <= n; i++){
		cin >> p[i].first >> p[i].second;
		s[i] = 0;
	}
	sort(p+1, p+n+1);
	for (int i = 1; i <= n; i++)
        s[i] = s[i - 1] + p[i].second;
    for(int i = 1; i <= n; i++){
    	maxx = max(maxx, p[i].first - s[i - 1]);
    	ans = max(ans, s[i] + maxx - p[i].first);
	}
    cout << ans << endl;
}

Compilation message

cc1plus: error: '::main' must return 'int'