제출 #242634

#제출 시각아이디문제언어결과실행 시간메모리
242634LucaDantasSure Bet (CEOI17_sure)C++17
0 / 100
5 ms256 KiB
#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 && !b.empty())) { 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'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...