# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
925561 | 2024-02-12T04:54:21 Z | May27_th | Balloons (CEOI11_bal) | C++17 | 140 ms | 11892 KB |
#include<bits/stdc++.h> #define taskname "A" using namespace std; void World_Final(); void Solve(); int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); if (fopen(taskname".inp", "r")) { freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout); } World_Final(); } void World_Final(){ int Tests = 1; //cin >> Tests; while (Tests --) { Solve(); } } const int mod = 1e9 + 7; struct ballon{ int64_t x; long double r; }; long double calc(int64_t d, long double r) { return 1.0 * d * d / (4 * r); } void Solve(){ int N; cin >> N; vector<ballon> b(N); for (auto &[x, r] : b) cin >> x >> r; stack<pair<int64_t, long double>> s; for (int i = 0; i < N; i ++) { long double rmax = b[i].r; while (!s.empty()) { long double rmax_last = calc(b[i].x - s.top().first, s.top().second); rmax = min(rmax, rmax_last); if (rmax >= s.top().second) s.pop(); else break; } cout << fixed << setprecision(3) << rmax << "\n"; s.push(make_pair(b[i].x, rmax)); } } /** A = I(i - 1, j), B = I(i, j - 1); |I(i, j)| = |A| + |B| - |A intersect B| **/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 552 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 1340 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 3380 KB | 50000 numbers |
2 | Correct | 33 ms | 3412 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 70 ms | 5972 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 82 ms | 6740 KB | 115362 numbers |
2 | Correct | 84 ms | 7324 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 116 ms | 8756 KB | 154271 numbers |
2 | Correct | 136 ms | 11892 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 140 ms | 10524 KB | 200000 numbers |
2 | Correct | 134 ms | 11820 KB | 199945 numbers |