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 lint;
typedef pair<int, int> pii;
const int INF = 2e9;
const int MOD = 1e9+7;
const int MAX = 1e5+10;
const lint LNF = 2e18;
int n;
double X[MAX], Y[MAX], ans;
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
for(int i=1; i<=n; i++)
cin>>X[i]>>Y[i];
sort(X+1, X+n+1, greater<double>());
sort(Y+1, Y+n+1, greater<double>());
for(int i=0, j=1; i<=n; i++){
static double a = 0, b = 0;
if(X[i]>1) a += X[i], a--, b--;
while(j<=n && b<a && Y[j]>1){
b += Y[j++], b--, a--;
}
ans = max(ans, min(a,b));
}
cout<<fixed;
cout.precision(4);
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... |