# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
202955 |
2020-02-18T19:31:28 Z |
Neklixx |
Balloons (CEOI11_bal) |
C++14 |
|
177 ms |
7904 KB |
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define sh cin.tie(0); cin.sync_with_stdio(0); cout.tie(0);
#define FILE freopen("test.in", "r", stdin);
#define vprint(v) for (int ii = 0; ii < v.size(); ii++){cout << v[ii] << " ";}
#define debugv(v) if (v.size() != 0) {cout << "[ "; for (int __ = 0; __ < (int)(v.size()) - 1; __++){cout << v[__] << ", ";} cout << v[(int)(v.size()) - 1] << " ]" << endl;} else {cout << "[]" << endl;}
#define debug cout << "-----------------------------------------------" << endl;
#define print1(a) cout << "{ " << a << " }" << endl;
#define print2(a, b) cout << "{ " << a << ", " << b << " }" << endl;
#define print3(a, b, c) cout << "{ " << a << ", " << b << ", " << c << " }" << endl;
#define print4(a, b, c, d) cout << "{ " << a << ", " << b << ", " << c << ", " << d << " }" << endl;
using namespace std;
#define int long long
const double INF = 1e11 + 228;
const int MAXN = 2e5 + 228;
double ans[MAXN];
double intersect1(double x1, double x2, double t1, double t2) {
//print4(x1, x2, t1, (((x2 / (2 * t2)) - (x1 / (2 * t1))) * 2 * t1 * t2) / (t1 - t2));
return ((((x2 / (2 * t2)) - (x1 / (2 * t1))) * 2 * t1 * t2) / (t1 - t2));
}
signed main()
{
#ifdef LOCAL
FILE;
#endif
sh;
int n;
cin >> n;
vector<pair<int, int>> v;
for (int i = 0; i < n; i++) {
int aa, bb;
cin >> aa >> bb;
v.pb({aa, bb});
}
vector<pair<double, double>> s;
vector<double> x1;
for (int i = 0; i < n; i++) {
double now = v[i].S;
int id = upper_bound(all(x1), (double)v[i].F) - x1.begin();
//print2(i, id);
if (s.size() > 0) {
pair<double, double> to = s[s.size() - id - 1];
double cl = (to.S * to.S) / (4 * to.F) + (v[i].F * v[i].F) / (4 * to.F) - (2 * v[i].F * to.S) / (4 * to.F);
now = min(now, cl);
}
while (s.size() > 0 && s.back().F <= now) {
s.pop_back();
}
while (x1.size() + 1 > s.size() && s.size() != 0) {
x1.pop_back();
}
ans[i] = now;
//print1(now);
if (s.size() > 0) {
x1.pb(intersect1(s.back().S, (double)v[i].F, sqrt(s.back().F), sqrt(now)));
}
//print1("ok");
s.pb({now, (double)v[i].F});
}
for (int i = 0; i < n; i++) {
cout << fixed << setprecision(4) << ans[i] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
376 KB |
7th numbers differ - expected: '0.0010000000', found: '9.0000000000', error = '8.9990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
504 KB |
114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
1372 KB |
196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
3028 KB |
6163rd numbers differ - expected: '8601.0000000000', found: '8602.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
94 ms |
4716 KB |
3653rd numbers differ - expected: '3933.0000000000', found: '8499.0000000000', error = '4566.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
5480 KB |
4249th numbers differ - expected: '426.0010000000', found: '427.0000000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
142 ms |
6624 KB |
1473rd numbers differ - expected: '284.0010000000', found: '285.0000000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
177 ms |
7904 KB |
1919th numbers differ - expected: '860.0000000000', found: '867.0000000000', error = '7.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |