Submission #913881

# Submission time Handle Problem Language Result Execution time Memory
913881 2024-01-20T11:33:11 Z nika7878 Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<pair<int, int>> a(n+1);
	for(int i=0; i<n; i++)
	{
		cin >> a[i].f >> a[i].s;
	}
	sort(a.begin(), a.end());
	for(int i=1; i<n; i++)
	{
		a[i].s=a[i-1].s+a[i].s;
	}
	int ans=0, x=0;
	for(int i=0; i<n; i++)
	{
		x=max(x, a[i].f-a[i-1].s);
		ans=max(ans, a[i].s-a[i].f+x);
	}
	cout << ans << endl;

}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -