# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875765 | Isam | Art Exhibition (JOI18_art) | C++17 | 1069 ms | 10028 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define a first
#define b second
#define pii pair<int, int>
using namespace std;
const int sz = 2e5 + 5;
const int inf = 1e15 + 7;
int n, ans;
pii c[sz];
int pref[sz];
int comp(int mna, int mxa, int s){
return s - (mxa - mna);
}
signed main(){
SPEED;
cin >> n;
for(register int i = 1; i <= n; ++i){
cin >> c[i].a >> c[i].b;
c[i].b *= (-1);
}
sort(c+1, c+n+1);
for(register int i = 1; i <= n; ++i) pref[i] = pref[i-1] - c[i].b;
for(register int i = 1; i < n; ++i){
for(register int j = i; j <= n; ++j){
int tmp = comp(c[i].a, c[j].a, pref[j] - pref[i-1]);
ans = max(ans, tmp);
}
}
cout << ans << '\n';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |