# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
699203 | Elrawy1 | Art Exhibition (JOI18_art) | C++17 | 0 ms | 212 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>
using namespace std;
typedef long long ll;
typedef string str ;
typedef double db;
#define endl '\n';
const int N=1e5+4;
const double pi=3.14159265359;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
cin>>n;
map<ll,ll>x;
ll sum=0;
ll d[n];
for(int i=0;i<n;i++){
ll m,k;
cin>>m>>k;
sum+=k;
x[m]+=k;
d[i]=m;
}
ll j=sum;
sort(d,d+n);
ll Max=0,s,o;
for(int h=0;h<n/2;h++){
sum=j;
for(int i=n-1;i>=h;i--){
s = d[i] - d[h];
Max = max(Max, (sum - s));
sum -= x[d[i]];
}
j-=x[d[h]];
}
cout<<Max;
}
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... |