# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1158648 | blick | Art Exhibition (JOI18_art) | C++20 | 0 ms | 324 KiB |
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
vector<pair<ll, ll>> a(n);
for(int i = 0; i < n; i++) {
cin>>a[i].S>>a[i].F;
}
sort(a.rbegin(), a.rend());
ll ans = 0;
for(int i = 0; i < n; i++) {
ll S=0, mn=LLONG_MAX, mx=LLONG_MIN;
for(int j = i; j < n; j++) {
S+=a[j].F;
mn=min(mn, a[j].S);
mx=max(mx, a[j].S);
ans=max(ans, S-(mx-mn));
}
}
cout<<ans<<'\n';
return 0;
}
# | 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... |