# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
401552 |
2021-05-10T13:25:39 Z |
benk |
Balloons (CEOI11_bal) |
C++14 |
|
196 ms |
8400 KB |
#include "bits/stdc++.h"
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
#define sz(x) (int)(x.size())
#define ll long long
#define fi first
#define se second
#define lbd lower_bound
#define ubd upper_bound
const int MOD = 1e9 + 7;
const double eps = 1e-10;
const long long INF = 1e18;
const int N = 2e5 + 10;
void solve() {
int n;
cin >> n;
vector<int> x(n), r(n);
for (int i = 0; i < n; i++) cin >> x[i] >> r[i];
vector<pair<int, double>> s;
for (int i = 0; i < n; i++) {
ll tmp;
while (sz(s) >= 2) {
tmp = 1LL * (x[i] - s.back().fi) * (x[i] - s.back().fi);
double r1 = (tmp * 4 * s[sz(s) - 2].se);
tmp = 1LL * (x[i] - s[sz(s) - 2].fi) * (x[i] - s[sz(s) - 2].fi);
double r2 = (tmp * 4 * s.back().se);
if (r1 >= r2) s.pop_back();
else break;
}
if (!s.empty())
tmp = 1LL * (x[i] - s.back().fi) * (x[i] - s.back().fi);
double ans;
if (s.empty()) ans = r[i];
else ans = min(1.0 * r[i], tmp / (4 * s.back().se));
cout << fixed << setprecision(10) << ans << '\n';
s.pb({x[i], ans});
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt = 1;
//cin >> tt;
while (tt--) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
17th numbers differ - expected: '213.0000000000', found: '234.0000000000', error = '21.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
332 KB |
504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1308 KB |
653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
50 ms |
2572 KB |
14174th numbers differ - expected: '0.7720000000', found: '1.3705055180', error = '0.5985055180' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
105 ms |
4460 KB |
7447th numbers differ - expected: '0.9750000000', found: '8.0000000000', error = '7.0250000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
122 ms |
4804 KB |
4793rd numbers differ - expected: '0.9540000000', found: '10.6222724122', error = '9.6682724122' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
182 ms |
7780 KB |
1734th numbers differ - expected: '1856.0220000000', found: '1865.0000000000', error = '8.9780000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
196 ms |
8400 KB |
2735th numbers differ - expected: '1883.4630000000', found: '1899.0000000000', error = '15.5370000000' |
2 |
Halted |
0 ms |
0 KB |
- |