# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
632541 |
2022-08-20T10:19:53 Z |
Aanjaney |
Balloons (CEOI11_bal) |
C++17 |
|
207 ms |
5436 KB |
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MODA 998244353
#define pb push_back
#define sortv(v) sort(v.begin(), v.end())
#define sorta(A, N) sort(A, A + N)
#define debug(x) cerr << #x << " is " << x;
#define rep(i, a, N) for (ll i = a; i < N; i++)
#define f first
#define s second
#define uniq(v) \
{ \
sort(v.begin(), v.end()); \
v.erase(unique(v.begin(), v.end()), v.end()); \
}
#define speed \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
double radius(double xi, double xj, double r)
{
double rad = (xi - xj) * (xi - xj);
rad /= double(4 * r);
return rad;
}
void solve(ll tcase)
{
ll n;
cin >> n;
stack<pair<double, double>> st;
rep(i, 0, n)
{
double x, r;
cin >> x >> r;
double ans = r;
while (!st.empty())
{
auto p = st.top();
ans = min(ans, radius(p.f, x, p.s));
if (ans >= p.s)
st.pop();
else
break;
}
cout << fixed << setprecision(3) << ans << "\n";
st.push({x, ans});
}
}
int main()
{
speed;
ll t = 1;
rep(i, 1, t + 1)
solve(i);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
328 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
456 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
54 ms |
856 KB |
50000 numbers |
2 |
Correct |
50 ms |
1600 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
1236 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
123 ms |
1372 KB |
115362 numbers |
2 |
Correct |
114 ms |
3280 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
168 ms |
1668 KB |
154271 numbers |
2 |
Correct |
195 ms |
5380 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
207 ms |
1880 KB |
200000 numbers |
2 |
Correct |
191 ms |
5436 KB |
199945 numbers |