Submission #271939

# Submission time Handle Problem Language Result Execution time Memory
271939 2020-08-18T08:03:34 Z MKutayBozkurt Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	sort(a.begin(), a.end());
	long long sum = 0, ans = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i].second;
		if (sum - (a[i].first - a[0].first) > ans) {
			ans = sum - (a[i].first - a[0].first);
		}
	}
	cout << ans << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -