# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1119485 |
2024-11-27T05:16:42 Z |
Miquella_ |
Balloons (CEOI11_bal) |
C++14 |
|
175 ms |
32192 KB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define S second
#define F first
#define all(x) (x).begin(), (x).end()
#define el "\n"
#define fo(i,a,b) for(int i =a;i<=b;i++)
#define fo1(i,a,b) for(int i =a;i>=b;i--)
#define bit(mask,i) ((mask>>i)&1)
#define pi pair<ll,ll>
#define NAME ""
using namespace std;
const int MAXN = 1e6+5;
const ll MOD = 1e9+7;
const int maxp = 2e7;
double n,a[MAXN],res,m,k,t,r[MAXN];
vector<ll> adj[MAXN];
deque<ll> deq;
double maxRadius(double x,double y,double x1) {
return ((x-x1)*(x-x1)) / (4*y);
}
void inp() {
cin >> n;
fo(i,1,n){
cin >> a[i] >> r[i];
}
}
void solve() {
fo(i,1,n) {
double temp = r[i];
while(!deq.empty()) {
ll pos = deq.back();
temp=min(temp, maxRadius(a[pos],r[pos],a[i]));
if(temp>=r[pos])deq.pop_back();
else break;
}
deq.push_back(i);
r[i]=temp;
cout << setprecision(3)<<fixed << r[i] << el;
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen(NAME".INP", "r", stdin);
// freopen(NAME".OUT", "w", stdout);
inp();
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
23888 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
23888 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
23888 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
23888 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
24380 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
25224 KB |
50000 numbers |
2 |
Correct |
48 ms |
25912 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
26312 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
109 ms |
27512 KB |
115362 numbers |
2 |
Correct |
93 ms |
28904 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
148 ms |
28472 KB |
154271 numbers |
2 |
Correct |
143 ms |
32192 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
175 ms |
29056 KB |
200000 numbers |
2 |
Correct |
145 ms |
32076 KB |
199945 numbers |