Submission #919680

#TimeUsernameProblemLanguageResultExecution timeMemory
919680buzdiBalloons (CEOI11_bal)C++14
20 / 100
170 ms11324 KiB
//#include <fstream> #include <iostream> #include <stack> #include <queue> #include <algorithm> #include <vector> #include <cassert> #include <map> #include <iomanip> #define ll long long #include <cmath> using namespace std; const int NMAX = 2e5; struct Point { long double x, y; void Read() { cin >> x >> y; } }; int n; Point a[NMAX + 1]; long double answer[NMAX + 1]; Point st[NMAX + 1]; int indst; long double Square(long double x) { return x * x; } long double Distance(Point p1, Point p2) { return sqrt(Square(p1.x - p2.x) - Square(p1.y - p2.y)); } long double Radius(Point p1, Point p2) { return Square(p2.x - p1.x) / (4.0 * p1.y); } bool Okay(Point p1, Point p2) { return p1.y + p2.y <= Distance(p1, p2); } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) a[i].Read(); for (int i = 1; i <= n; i++) { while (indst > 1 && !Okay({ a[i].x, Radius(st[indst], a[i]) }, st[indst - 1])) indst--; if (indst > 0 && Radius(st[indst], a[i]) <= a[i].y) a[i].y = Radius(st[indst], a[i]); st[++indst] = a[i]; } for (int i = 1; i <= n; i++) cout << fixed << setprecision(3) << a[i].y << '\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...