# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
492238 |
2021-12-06T05:37:27 Z |
darkowl |
Balloons (CEOI11_bal) |
C++14 |
|
200 ms |
5068 KB |
/// I in it to win it !
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define F first
#define S second
#define mp make_pair
#define pii pair<int, int>
#define pb push_back
#define pf push_front
#define arr_fill(a, n) for(ll i = 0 ; i < n ; i++){cin >> a[i];}
#define arr_fill_sum(a,n,sum) for (ll i = 0 ; i < n ; i++){cin >> a[i];sum+=a[i];}
#define arr_out(a,n) for (ll i = 0 ; i < n ; i++){cout << a[i] <<" ";}
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll MAXN = 1e6 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 7;
ll pw(ll a, ll b){return b == 0 ? 1LL : (pw(a * a , b / 2) * (b % 2 == 0 ? 1LL : a));}
stack < int > s;
double x[MAXN], r[MAXN];
void solve ()
{
int n; cin >> n ;
cout << fixed << setprecision(3);
for(int i = 0; i < n; i++)
{
cin >> x[i] >> r[i];
if (s.empty())
{s.push(i); cout << r[i] <<"\n"; continue;}
double vd = ((double)(pw(x[i] - x[s.top()], 2)/(4 * r[s.top()])));
s.push(i);
if (vd > r[i])
{cout << r[i] << "\n" ;s.pop();}
else
{cout << vd << "\n" ; r[i] = vd;}
}
}
int32_t main()
{
fast
int t = 1; //cin >> t;
while (t--)
{
solve();
}
return 0;
}
///Thanks GOD :))
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000' |
# |
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 |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
6th numbers differ - expected: '116.0020000000', found: '117.0000000000', error = '0.9980000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
716 KB |
11th numbers differ - expected: '201.0010000000', found: '202.0000000000', error = '0.9990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
1504 KB |
5th numbers differ - expected: '15395.0000000000', found: '15396.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
116 ms |
2732 KB |
14th numbers differ - expected: '7919.0000000000', found: '7920.0000000000', error = '1.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
125 ms |
3140 KB |
5th numbers differ - expected: '5054.0000000000', found: '5055.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
170 ms |
4100 KB |
15th numbers differ - expected: '1860.0000000000', found: '1861.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
200 ms |
5068 KB |
11th numbers differ - expected: '2951.0000000000', found: '2952.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |