# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1116642 |
2024-11-22T03:13:06 Z |
pemguimn |
Balloons (CEOI11_bal) |
C++14 |
|
98 ms |
12356 KB |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int n, x[N], r[N];
long double ans[N];
inline long double calc(int i, int j){
long double x1 = x[i], y1 = ans[i];
long double x2 = x[j];
return (x1 * x1 + x2 * x2 - 2.0L * x1 * x2) / (4.0L * y1);
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> x[i] >> r[i];
ans[i] = r[i];
}
stack<int> st;
for(int i = 1; i <= n; i++){
while(st.size()){
ans[i] = min(ans[i], calc(st.top(), i));
if(ans[i] < ans[st.top()]) break;
st.pop();
}
if(ans[i] > 0.0L) st.push(i);
}
for(int i = 1; i <= n; i++)
cout << setprecision(3) << fixed << ans[i] << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4432 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4600 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4432 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4432 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
8908 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
9116 KB |
50000 numbers |
2 |
Correct |
23 ms |
9156 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
9552 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
67 ms |
9868 KB |
115362 numbers |
2 |
Correct |
57 ms |
9348 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
12264 KB |
154271 numbers |
2 |
Correct |
93 ms |
12112 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
98 ms |
12356 KB |
200000 numbers |
2 |
Correct |
84 ms |
11936 KB |
199945 numbers |