Submission #913854

# Submission time Handle Problem Language Result Execution time Memory
913854 2024-01-20T11:08:04 Z lukameladze Art Exhibition (JOI18_art) C++17
10 / 100
1 ms 444 KB
#include<bits/stdc++.h>
using namespace std;
int s[500001];
#define int long long
int32_t 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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -