Submission #703195

#TimeUsernameProblemLanguageResultExecution timeMemory
703195Markomafko972Balloons (CEOI11_bal)C++14
100 / 100
188 ms8548 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; long double r; stack< pair<long double, int> > s; long 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; long double naj = r; while (s.size() > 0) { long double tren = s.top().Y-pos; tren *= tren; tren /= 4; tren /= s.top().X; if (tren <= naj) { if (tren < s.top().X) { naj = min(naj, tren); break; } else { s.pop(); //if (tren > naj) break; naj = min(naj, tren); } } else { if (naj < 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...