# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
913857 |
2024-01-20T11:08:56 Z |
cot |
Art Exhibition (JOI18_art) |
C++14 |
|
1 ms |
4444 KB |
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <climits>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define pii pair <int,int>
#define r0 return 0
using namespace std;
const int N = 5 * 1e5 + 5;
int x,m,k,n,l,r,ans,cheese;
int pref[N],p[N],mn;
pii a[N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].ff >> a[i].ss;
}
sort(a + 1,a + 1 + n);
p[0] = -a[1].ff;
pref[0] = 0;
for (int i = 1; i <= n; i++){
pref[i] = pref[i - 1] + a[i].ss;
p[i] = min(p[i - 1],pref[i] - a[i].ff);
}
k = -LLONG_MAX;
for (int i = 1; i <= n; i++) {
k = max(k,pref[i] - a[i].ff - p[i - 1]);
}
cout << k << endl;
r0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |