# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1111205 |
2024-11-11T17:12:12 Z |
vjudge1 |
Balloons (CEOI11_bal) |
C++17 |
|
494 ms |
8624 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using std::mt19937_64;
using std::random_device;
using std::uniform_int_distribution;
#include <numeric>
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define w(x) int x; cin>>x; while(x--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void c_p_c()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
freopen("milkvisits.in", "r", stdin);
freopen("milkvisits.out", "w", stdout);
#endif*/
}
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int exp(int x, int n, int m) {
if(x == 0 and n == 0) return 1;
x %= m;
int res = 1;
while (n > 0) {
if (n % 2 == 1) { res = res * x % m; }
x = x * x % m;
n /= 2;
}
return res;
}
long double check(pair<long double,long double> &p1,int a,int b){
long double dist= (p1.ff-a)*(p1.ff-a);
long double rad = dist/(4*p1.ss);
return rad;
}
signed main()
{
int t=1;
c_p_c();
// cin >> t;
while(t--){
int n;
cin >> n;
stack<pair<long double,long double>> st;
vector<long double> ans(n);
for(int i = 0 ; i < n; i++){
long double a,b;
cin >> a >> b;
long double y = b;
while(!st.empty()){
long double rad= check(st.top(),a,b);
y = min(y,rad);
if(y >= st.top().ss){
st.pop();
}
else{
break;
}
}
st.push({a,y});
ans[i] = y;
}
cout<<fixed<<setprecision(3);
for(auto &x:ans){
cout<<x<<endl;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
592 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
336 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
336 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
1084 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
2492 KB |
50000 numbers |
2 |
Correct |
105 ms |
2556 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
254 ms |
4524 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
5284 KB |
115362 numbers |
2 |
Correct |
251 ms |
5304 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
349 ms |
6732 KB |
154271 numbers |
2 |
Correct |
435 ms |
8624 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
428 ms |
7856 KB |
200000 numbers |
2 |
Correct |
494 ms |
8520 KB |
199945 numbers |