This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define panic break
#define pii pair<int,int>
#define pic pair<int,char>
#define all(x) (x).begin(),(x).end()
#define sum(a) accumulate(all(a),0)
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL)
#define terminator main
#define N 2001
ld prex[N];
ld prey[N];
void solve(){
int n;
ld o,p,q;
cin>>n;
vector<ld> x,y;
for(int i=o=0;i<n;i++){
cin>>p>>q;
x.append(p);
y.append(q);
}
sort(all(x));
sort(all(y));
for(int i=0;i<N;i++)
prex[i]=prey[i]=0;
for(int i=n-1;i>=0;i--){
prex[n-i]=prex[n-i-1]+x[i];
prey[n-i]=prey[n-i-1]+y[i];
}
for(int i=1;i<=2*n;i++)
for(int j=0;j<=i;j++)
o=max(o,min(prex[j],prey[i-j])-i);
cout<<o;
}
int terminator(){
L0TA;
cout<<fixed<<setprecision(4);
solve();
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... |