# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1030168 |
2024-07-21T22:11:15 Z |
shezitt |
Balloons (CEOI11_bal) |
C++14 |
|
141 ms |
14936 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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<int> dist(1, 10);
#define ll long long
#define ld long double
#define gcd(a, b) __gcd(a, b)
#define lcm(a,b) a/gcd(a,b)*b
#define pb push_back
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int>>
#define F first
#define S second
#define sz(x) (int)x.size()
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fore(a, b, c) for(int a=b; a<c; ++a)
#define all(x) x.begin(), x.end()
#define int ll
#define endl '\n';
template <typename T>
using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#define raya cerr << "==========================" << endl;
const double EPS = 1e-7;
const double PI = acos(-1);
const int MOD = 1e9+7;
int TC = 0;
void solve(){
int n;
cin >> n;
vector<ld> X(n), R(n);
fore(i, 0, n){
cin >> X[i] >> R[i];
}
vector<ld> ans(n);
stack<pair<ld,ld>> st;
fore(i, 0, n){
ld x = X[i], r = R[i];
// los menores no me interesan
while(!st.empty()){
auto [x1, r1] = st.top();
r = min(r, (x-x1)*(x-x1)/(4*r1));
if(r1 < r){
st.pop();
} else break;
}
st.push({x, r});
ans[i] = r;
}
cout << fixed << setprecision(6);
fore(i, 0, n){
cout << ans[i] << endl;
}
}
signed main(){
fast;
int tt = 1;
// cin >> tt;
while(tt--){
TC++;
solve();
}
}
Compilation message
bal.cpp: In function 'void solve()':
bal.cpp:70:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
70 | auto [x1, r1] = st.top();
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
1624 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
3596 KB |
50000 numbers |
2 |
Correct |
32 ms |
3924 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
6628 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
7580 KB |
115362 numbers |
2 |
Correct |
71 ms |
9040 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
9736 KB |
154271 numbers |
2 |
Correct |
125 ms |
14936 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
141 ms |
12112 KB |
200000 numbers |
2 |
Correct |
129 ms |
14924 KB |
199945 numbers |