# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
772105 |
2023-07-03T16:11:50 Z |
NK_ |
Balloons (CEOI11_bal) |
C++17 |
|
141 ms |
6932 KB |
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
using ld = long double;
const ld eps = 1e-9;
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(10);
int N; cin >> N;
vector<pair<int, ld>> A;
for(int i = 0; i < N; i++) {
int x, r; cin >> x >> r;
ld ans = r;
while(size(A)) {
ld D = ld(x - A.back().first) * ld(x - A.back().first);
ld R = min(ld(r), D / (4 * A.back().second));
if ((ans - R) > 0) ans = R;
// cout << ans - R << " - " << x << endl;
if (ans+eps > A.back().second) A.pop_back();
else break;
}
cout << ans << nl;
A.push_back({x, ans});
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
568 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1512 KB |
50000 numbers |
2 |
Correct |
32 ms |
1992 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
2276 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
105 ms |
2500 KB |
115362 numbers |
2 |
Correct |
73 ms |
4236 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
129 ms |
3048 KB |
154271 numbers |
2 |
Correct |
123 ms |
6932 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
3420 KB |
200000 numbers |
2 |
Correct |
122 ms |
6860 KB |
199945 numbers |