# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1094840 |
2024-09-30T16:12:11 Z |
Kodik |
Balloons (CEOI11_bal) |
C++17 |
|
2000 ms |
3416 KB |
#include <bits/stdc++.h>
using namespace std;
#define ss second
#define ff first
typedef long long ll;
typedef long double ld;
#define int ll
bool check(ld nr, ld lr, ld nx, ld lx){
ld radius = abs(nr-lr);
ld distance = abs(nx-lx);
ld pyt = lr + nr;
return (radius*radius + distance*distance - pyt*pyt ) >= ld(1e-8);
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<ld> answer(n);
stack<pair<ld,ld>> st;
for(int i = 0; i < n; ++i){
ld cor, mr;
cin >> cor >> mr;
if(st.empty()){
answer[i] = mr;
st.push({mr,cor});
}else{
while(true){
auto &[lr, lx] = st.top();
ld l = 0, r = mr;
while(r-l>1e-8){
ld mid = l + (r-l+1)/2;
if(check(mid, lr, cor, lx)){
l = mid;
}else{
r = mid;
}
}
mr = l;
if(l>lr){
st.pop();
mr = l;
if(st.empty()){
answer[i] = mr;
st.push({mr,cor});
break;
}
}else{
st.push({mr,cor});
answer[i] = mr;
break;
}
}
}
}
for(int i = 0; i < n; ++i){
cout << answer[i] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2072 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2065 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2069 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2055 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2060 ms |
604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2041 ms |
1112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2019 ms |
1880 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2005 ms |
2136 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2049 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2102 ms |
3416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |