이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define FORi(i,a,b) for(ll i=a;i<(ll)b;i++)
#define FOR(i,n) FORi(i,0,n)
#define FOA(v,a) for(auto v : a)
int main(){
int n;
cin>>n;
vector<double> a(n), b(n);
FOR(i,n) cin>>a[i]>>b[i];
sort(a.begin(), a.end(), [](double a, double b){return a>b;});
sort(b.begin(), b.end(), [](double a, double b){return a>b;});
double ans=0;
double sa=0;
FOR(i,n){
sa+=a[i];
double sj=0;
FOR(j,n){
sj+=b[j];
ans = max(ans, min(sj-(i+j+2), sa-(i+j+2)));
}
}
cout<<fixed<<setprecision(4)<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |