제출 #701040

#제출 시각아이디문제언어결과실행 시간메모리
701040Markomafko972Balloons (CEOI11_bal)C++14
40 / 100
153 ms6072 KiB
#include <bits/stdc++.h> #define X first #define Y second #define pb push_back #define pii pair<int, int> typedef long long ll; using namespace std; const int MOD = 1e9 + 7; const ll INF = 1e18; const int OFF = (1 << 20); int n; int pos; double r; stack< pair<double, int> > s; double sol[200005]; int main () { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> pos >> r; double naj = r; while (s.size() > 0) { double tren = s.top().Y-pos; tren *= tren; tren /= 4; tren /= s.top().X; if (tren <= r) { if (tren < s.top().X) { naj = min(naj, tren); break; } else { naj = min(naj, tren); s.pop(); } } else { if (r < s.top().X) break; else s.pop(); } } sol[i] = naj; s.push({naj, pos}); } for (int i = 0; i < n; i++) cout << fixed << setprecision(3) << sol[i] << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...