/// In the name of GOD
/// I love my MOTHER
/// Only GOLD
#include <bits/stdc++.h>
#define sz(s) (ll)(s.size())
#define all(x) (x.begin(), x.end())
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ort1 exit(0);
#define nl endl
#define db double
#define TL clock() / (double)CLOCKS_PER_SEC
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double pi = acos(-1.0);
const double eps = 1e-9;
const int mod = 1e9 + 7;
const ll INF = 1e12 + 1;
const int N = 1e5 + 9;
int n;
double l[N], r[N];
double mx;
double ans[N], san[N];
int main()
{
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> l[i] >> r[i];
}
sort(l + 1, l + 1 + n);
sort(r + 1, r + 1 + n);
reverse(l + 1, l + 1 + n);
reverse(r + 1, r + 1 + n);
for(int i = 1; i <= n; ++i){
ans[i] = ans[i - 1] + l[i];
san[i] = san[i - 1] + r[i];
}
for(int i = 0; i <= n; ++i){
for(int j = 0; j <= n; ++j){
double mn = mod;
mn = min(mn, double(san[j] - (double)(i + j)) );
mn = min(mn, double(ans[i] - (double)(i + j)) );
mx = max(mx, mn);
}
}
cout << fixed << mx << setprecision(4);
ort1
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |