# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1063643 |
2024-08-17T22:03:40 Z |
daviedu |
Balloons (CEOI11_bal) |
C++17 |
|
111 ms |
14928 KB |
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define ld long double
struct P{
ll x, y;
};
void dbg_out() { cerr << endl; }
template <typename H, typename... T>
void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); }
#define dbg(...) { cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); }
ld max_r(ll a, ll b, ld R){
return (a-b)*(a-b) / (4*R);
}
signed main(){
fastio;
int n;
cin >> n;
vector<pair<int, ld>> arr (n);
for (int i=0; i<n; i++){
cin >> arr[i].first >> arr[i].second;
}
vector<ld> ans (n);
stack<int> can_touch;
for (int i=0; i<n; i++){
auto [x, r] = arr[i];
ld best=r;
while (!can_touch.empty()){
int X = arr[can_touch.top()].first;
ld R = ans[can_touch.top()];
// touches
if (best >= max_r(x, X, R)) best = max_r(x, X, R);
if (best >= R) can_touch.pop();
else break;
}
ans[i] = best;
can_touch.push(i);
}
cout << fixed << setprecision(3);
for (int i=0; i<n; i++) cout << ans[i] << ' ';
cout << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
1372 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
3160 KB |
50000 numbers |
2 |
Correct |
26 ms |
3920 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
5968 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
6904 KB |
115362 numbers |
2 |
Correct |
61 ms |
9044 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
111 ms |
9044 KB |
154271 numbers |
2 |
Correct |
103 ms |
14764 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
109 ms |
11320 KB |
200000 numbers |
2 |
Correct |
101 ms |
14928 KB |
199945 numbers |