#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
#define double long double
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr)
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define dec(i,n,a) for(int i=(n); i>=(a); i--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()
constexpr int inf = 0x3f3f3f3f;
constexpr int MAXN = 1e5 + 10;
constexpr int mod = 1000000007;
int main() {
int n; cin >> n;
priority_queue<double> a, b;
rep(i,0,n) {
double x, y;
cin >> x >> y;
a.push(x); b.push(y);
}
double A = 0, B = 0, ans = -10000;
rep(i,0,2*n) {
if(a.empty() || B <= A) {
assert(!b.empty());
double now = b.top();
b.pop();
A--;
B += now - 1;
ans = max(ans, min(A, B));
}
else if(b.empty() || A < B) {
assert(!a.empty());
double now = a.top();
a.pop();
B--;
A += now - 1;
ans = max(ans, min(A, B));
}
}
cout << fixed;
cout << setprecision(4);
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |