# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
485096 |
2021-11-06T07:33:24 Z |
LptN21 |
Balloons (CEOI11_bal) |
C++14 |
|
281 ms |
7680 KB |
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define PI acos(-1.0)
#define FF first
#define SS second
#define eps 1e-3
// vector
#define pb push_back
#define sz(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define lb lower_bound
#define ub upper_bound
// bit
#define CNTBIT(x) __builtin_popcount(x)
#define ODDBIT(x) __builtin_parity(x)
#define MASK(i) (1ll<<(i))
#define BIT(x, i) (((x)>>(i))&1)
#define SUBSET(big, small) (((big)&(small))==(small))
#define MINBIT(x) (x)&(-x)
// typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> i3;
/* CODE BELOW */
const int N=200000+7, M=30+1, K=26+1;
const int MOD=998244353;
const int oo=1e9+7;
int n, m, k, t;
int x[N];
double r[N];
signed main() {
//freopen("test.inp", "r", stdin);
//freopen("test.out", "w", stdout);
//fastIO;
cin>>n;
for(int i=1;i<=n;i++) {
cin>>x[i]>>r[i];
}
#define sqr(x) 1LL*(x)*(x)
stack<int> st;
for(int j, i=1;i<=n;i++) {
while(sz(st)) {
j=st.top();
double R=sqr(x[i]-x[j])/(4*r[j]);
r[i]=min(r[i], R);
if(r[j]<=r[i]) st.pop();
else break;
}
st.push(i);
}
cout.precision(3);
for(int i=1;i<=n;i++) {
cout<<fixed<<r[i]<<"\n";
}
return 0;
}
/* stuff you should look for
- int overflow, array bounds
- special/edge cases (n=1?)
- do smth instead of nothing and stay organized
- WRITE STUFF DOWN
- DONT JUST STICK ON ONE APPROACH
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
332 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
628 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
89 ms |
1248 KB |
50000 numbers |
2 |
Correct |
72 ms |
2108 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
130 ms |
2328 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
202 ms |
2628 KB |
115362 numbers |
2 |
Correct |
166 ms |
4704 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
206 ms |
3520 KB |
154271 numbers |
2 |
Correct |
272 ms |
7648 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
245 ms |
4172 KB |
200000 numbers |
2 |
Correct |
281 ms |
7680 KB |
199945 numbers |