# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445822 | 2021-07-19T18:27:06 Z | O_o | Balloons (CEOI11_bal) | C++14 | 179 ms | 11740 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double #define rep(i,a,b) for(int i=a;i<b;i++) #define repb(i,a,b) for(int i=a;i>=b;i--) #define pb push_back #define mp make_pair #define all(A) A.begin(),A.end() #define allr(A) A.rbegin(),A.rend() #define precise(i) fixed << setprecision(i) #define fi first #define se second #define sz(x) ((int)(x).size()) #define err() cout<<"\n==================================\n"; #define errA(A) for(auto i:A) cout<<i<<" "; cout<<"\n"; #define err1(a) cout<<#a<<" "<<a<<"\n"; #define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<"\n"; #define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<"\n"; #define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<"\n"; const int logN = 20; const int M = 1000000007; const int INF = 1e17; #define PI 3.14159265; const int N = 200005; #define Pii pair<int,int> #define Vi vector<int> #define Vpii vector<Pii> #define PQ priority_queue<int> void setIO(string d_name = "") { ios_base::sync_with_stdio(0); cin.tie(0); if(sz(d_name)){ freopen((d_name+".in").c_str(), "r", stdin); freopen((d_name+".out").c_str(), "w", stdout); } } int32_t main() { setIO(); int n; cin>>n; Vpii b(n); rep(i,0,n) { cin>>b[i].fi>>b[i].se; } stack<pair<ld, ld>> s; vector<ld> ans(n); rep(i,0,n) { ld rad= (ld)(b[i].se); while(!s.empty()) { pair<ld, ld> p= s.top(); rad= min(rad, ((p.fi-b[i].fi)*(p.fi-b[i].fi)/(4.0*(p.se)))); if(rad >= p.se) { s.pop(); continue; } else { break; } } s.push(mp((ld)(b[i].fi), rad)); ans[i]= rad; } rep(i,0,n) { cout<<precise(3)<<ans[i]<<"\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 2 ms | 388 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 1056 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 2660 KB | 50000 numbers |
2 | Correct | 40 ms | 3132 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 104 ms | 4548 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 111 ms | 5184 KB | 115362 numbers |
2 | Correct | 93 ms | 7160 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 155 ms | 6688 KB | 154271 numbers |
2 | Correct | 154 ms | 11736 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 179 ms | 8180 KB | 200000 numbers |
2 | Correct | 156 ms | 11740 KB | 199945 numbers |