Submission #961786

# Submission time Handle Problem Language Result Execution time Memory
961786 2024-04-12T12:49:54 Z raspy Art Exhibition (JOI18_art) C++14
0 / 100
2 ms 2392 KB
#include <iostream>
#include <algorithm>

#define int long long

using namespace std;

struct slika
{
	int vel;
	int vr;
};

slika a[500005];
int kum[500005];

int32_t main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i].vel >> a[i].vr;
	sort(a, a+n, [](slika pr, slika dr){
		return pr.vel < dr.vel;
	});
	for (int i = 1; i <= n; i++)
		kum[i] = kum[i-1]+a[i-1].vr;
	int rez = 0, str = 0;
	for (int i = 0; i < n; i++)
	{
		rez = max(rez, kum[i+1]-kum[str]-a[i].vel+a[str].vel);
		if (a[i].vel > kum[i]-kum[str]+a[str].vel)
			str = i;
	}
	cout << rez << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -