# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
607244 |
2022-07-26T13:54:17 Z |
Duy_e |
Balloons (CEOI11_bal) |
C++14 |
|
186 ms |
5176 KB |
#include <bits/stdc++.h>
#define ll long long
#define pii pair<ll, ll>
#define st first
#define nd second
#define file "test"
using namespace std;
const long long INF = 1e18;
const long long N = 2e5 + 5;
const long long eps = 1e-6;
stack <int> st;
ll x[N], n;
double r[N];
bool touch(int i, int j) {
double a = r[i] - r[j], b = x[j] - x[i];
double c = a * a + b * b;
double sum = r[i] + r[j];
return !(sum * sum > c);
}
double cal(int i, int j) {
if (i == 0) return r[j];
double a = r[i], b = x[j] - x[i];
double ans = b * b / ((double)4.0 * a);
return min(ans, r[j]);
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#ifndef ONLINE_JUDGE
// freopen(file".inp", "r", stdin); freopen(file".out", "w", stdout);
//#endif
cin >> n;
st.push(0);
for (int i = 1; i <= n; i ++) {
cin >> x[i] >> r[i];
while (st.size() > 1 && !touch(st.top(), i) && r[i] >= r[st.top()]) st.pop();
r[i] = cal(st.top(), i);
st.push(i);
cout << setprecision(3) << fixed << r[i] << '\n';
}
return 0;
}
/** /\_/\
* (= ._.)
* / >🍵 \>🍮
**/
Compilation message
bal.cpp:49:9: warning: "/*" within comment [-Wcomment]
49 | /** /\_/\
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
752 KB |
2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
1576 KB |
2nd numbers differ - expected: '15398.0000000000', found: '24984.0000000000', error = '9586.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
97 ms |
2788 KB |
2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
3288 KB |
2nd numbers differ - expected: '5059.0000000000', found: '5060.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
145 ms |
4164 KB |
2nd numbers differ - expected: '1873.0000000000', found: '1874.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
186 ms |
5176 KB |
2nd numbers differ - expected: '2961.0000000000', found: '2962.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |