#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
string padding(long long n, long long l, char c){
string res = "";
long long nm = pow(10, l);
while(nm>n){
n *=10;
res += c;
}
return res;
}
long long main(){
long long N; cin>>N;
long long a[100100], b[100100];
long long sc = 10000;
double f, s;
for(long long n=0; n<N; n++){
cin>>f>>s;
a[n] = f*10000;
b[n] = s*10000;
}
sort(a, a+N);
sort(b, b+N);
long long ans = 0;
long long l = N-2, r = N-2;
long long lo = a[N-1], ro = b[N-1];
long long bt = 2;
while(l>=0||r>=0){
ans = max(ans, min(lo, ro)-bt*sc);
if(lo==ro){
if(l>=0&&r<0){
lo += a[l--];
bt++;
} else if(l<0&&r>=0){
ro += b[r--];
bt++;
} else {
if(b[r]>a[l]){
ro += b[r--];
bt++;
} else {
lo += a[l--];
bt++;
}
}
}
else if(lo<ro){
if(l>=0){
lo += a[l--];
bt++;
} else {
break;
}
} else {
if(r>=0){
ro += b[r--];
bt++;
} else {
break;
}
}
ans = max(ans, min(lo, ro)-bt*sc);
}
double dans = ans;
prlong longf("%.4f\n", dans/((double)sc));
return 0;
}
Compilation message
sure.cpp:17:16: error: '::main' must return 'int'
long long main(){
^
sure.cpp: In function 'int main()':
sure.cpp:71:2: error: 'prlong' was not declared in this scope
prlong longf("%.4f\n", dans/((double)sc));
^~~~~~
sure.cpp:71:2: note: suggested alternative: 'ulong'
prlong longf("%.4f\n", dans/((double)sc));
^~~~~~
ulong
sure.cpp:70:9: warning: unused variable 'dans' [-Wunused-variable]
double dans = ans;
^~~~