# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
865017 | 2023-10-24T02:03:40 Z | nnhzzz | Balloons (CEOI11_bal) | C++14 | 414 ms | 8860 KB |
#include<bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i = (a); i<=(b); ++i) #define REPD(i,a,b) for(int i = (a); i>=(b); --i) #define REPDIS(i,a,b,c) for(int i = (a); i<=(b); i += c) #define ALL(x) (x).begin(),(x).end() #define SZ(x) (int)(x).size() #define BIT(x,i) ((x>>i)&1LL) #define MASK(i) (1LL<<i) #define fi first #define se second #define vi vector<int> #define vvi vector<vi> #define vvvi vector<vvi> #define pii pair<int,int> #define vpii vector<pii> #define ll long long #define ld long double #define MP make_pair //---------------------------------------------------------------------------------------// const int inf = 1e9,LOG = 18,MAXN = 5e5+7,N = 1e2+3; const int MOD = 1e9+7,MOD1 = 1e9+207,MOD2 = 1e9+407,MOD3 = 998244353; //---------------------------------------------------------------------------------------// template<typename T> bool mini(T &a, const T &b){if(a>b){a=b;return true;} return false;} template<typename T> bool maxi(T &a, const T &b){if(a<b){a=b;return true;} return false;} //---------------------------------------------------------------------------------------// ld sqr(ld x){ return (ld)x*x; } void solve(){ int n; cin >> n; stack<pair<ld,ld> > st; // st.push(MP(0,0)); while(n--){ ld x,r; cin >> x >> r; while(SZ(st)!=0){ mini(r,sqr(x-st.top().fi)/st.top().se/4.0); if(r>st.top().se){ st.pop(); }else{ break; } } st.push(MP(x,r)); cout << fixed << setprecision(3) << r << endl; } } signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "test" if(fopen(task".inp","r")){ freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } #define task1 "nnhzzz" if(fopen(task1".inp","r")){ freopen(task1".inp","r",stdin); freopen(task1".out","w",stdout); } solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 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 | 4 ms | 516 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 852 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 106 ms | 2088 KB | 50000 numbers |
2 | Correct | 100 ms | 2388 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 209 ms | 3052 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 252 ms | 3464 KB | 115362 numbers |
2 | Correct | 244 ms | 5460 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 335 ms | 4112 KB | 154271 numbers |
2 | Correct | 405 ms | 8784 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 414 ms | 4688 KB | 200000 numbers |
2 | Correct | 408 ms | 8860 KB | 199945 numbers |