# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
929150 |
2024-02-17T18:45:45 Z |
Aanjaney |
Balloons (CEOI11_bal) |
C++17 |
|
115 ms |
11316 KB |
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define speed \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
bool no_conflict(double ri, double rj, ll xi, ll xj)
{
double lhs = 4 * ri * rj;
double rhs = (xi - xj) * (xi - xj);
return lhs > rhs;
}
double calc_r(ll xi, ll xj, double rj)
{
double numerator = (xi - xj) * (xi - xj);
double denominator = 4 * rj;
return numerator / double(denominator);
}
void solve(ll tc)
{
ll n;
cin >> n;
vector<ll> x(n), r(n);
vector<double> res(n);
for (ll i = 0; i < n; ++i)
{
cin >> x[i] >> r[i];
}
stack<pair<ll, double>> s;
for (ll i = 0; i < n; ++i)
{
if (s.empty())
res[i] = double(r[i]);
else
{
while (!s.empty() && double(r[i]) > s.top().second && no_conflict(r[i], s.top().second, x[i], s.top().first))
s.pop();
if (!s.empty())
res[i] = min(double(r[i]), calc_r(x[i], s.top().first, s.top().second));
else
res[i] = double(r[i]);
}
s.push({x[i], r[i]});
}
for (ll i = 0; i < n; ++i)
cout << fixed << setprecision(3) << res[i] << "\n";
}
int main()
{
speed;
ll t = 1;
// cin >> t;
for (ll i = 1; i <= t; i++)
solve(i);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 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 |
456 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 |
348 KB |
3rd numbers differ - expected: '0.0420000000', found: '2.0830000000', error = '2.0410000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
3rd numbers differ - expected: '121.0000000000', found: '120.0180000000', error = '0.9820000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
1316 KB |
3rd numbers differ - expected: '211.0000000000', found: '210.0110000000', error = '0.9890000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
3172 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 |
57 ms |
6376 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 |
68 ms |
7252 KB |
6th numbers differ - expected: '5053.0000000000', found: '5052.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
96 ms |
9964 KB |
3rd numbers differ - expected: '1872.0000000000', found: '1871.0010000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
115 ms |
11316 KB |
3rd numbers differ - expected: '2960.0000000000', found: '2959.0010000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |