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 <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
vector <double> x;
vector <double> y;
bool comp(double a, double b){
return a > b;
}
int main(){
int n;
cin >> n;
for (int i = 0; i < n; i++){
double a, b;
cin >> a >> b;
x.push_back(a);
y.push_back(b);
}
sort(x.begin(), x.end(), comp);
sort(y.begin(), y.end(), comp);
x[0]--;
y[0]--;
for (int i = 1; i < n; i++){
x[i] = x[i]-1 + x[i-1];
y[i] = y[i]-1 + y[i-1];
}
int i = 0, j = 0;
double mx = 0;
while (i < n && j < n){
double a = x[i]-j-1;
double b = y[j]-i-1;
if (a <= b)i++;
if (a > b)j++;
if (min(a,b) > mx)mx = min(a,b);
}
printf("%.4lf",(double)mx);
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... |