Submission #485611

#TimeUsernameProblemLanguageResultExecution timeMemory
485611AkiYuuBalloons (CEOI11_bal)C++17
100 / 100
209 ms11312 KiB
#include <bits/stdc++.h> #define task "GROUP" #define ll long long #define ld long double #define pb(u) emplace_back(u) #define ffw(i,a,b) for (ll i = a; i <= b; i++) #define fbw(i,b,a) for (ll i = b; i >= a; i--) #define adj(v,adj,u) for (auto v : adj[u]) #define rep(i,a) for (auto i : a) #define reset(a) memset(a, 0, sizeof(a)) #define sz(a) a.size() #define all(a) a.begin(),a.end() using namespace std; inline namespace FastIO { const int BSZ = 1<<15; char ibuf[BSZ]; int ipos, ilen; char nc() { // if (ipos == ilen) { ipos = 0; ilen = fread(ibuf,1,BSZ,stdin); if (!ilen) return EOF; } return ibuf[ipos++]; } void readstr(string& x) { char ch; while (isspace(ch = nc())); do { x += ch; } while (!isspace(ch = nc()) && ch != EOF); } template<class T> void readnum(T& x){ char ch; int sgn = 1; while (!isdigit(ch = nc())) if (ch == '-') sgn *= -1; x = ch-'0'; while (isdigit(ch = nc())) x = x*10+(ch-'0'); x *= sgn; } } const int mxn = 1e6 + 5; typedef pair<ld, ld> ii; void fastio(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen(task".inp", "r", stdin); // freopen(task".out", "w", stdout); } // _oo0oo_ // o8888888o // 88" . "88 // (| -_- |) // 0\ = /0 // ___/`---'\___ // .' \| |// '. // / \||| : |||// \ // / _||||| -:- |||||- \ // | | \\ - /// | | // | \_| ''\---/'' |_/ | // \ .-\__ '-' ___/-. / // ___'. .' /--.--\ `. .'___ // ."" '< `.___\_<|>_/___.' >' "". // | | : `- \`.;`\ _ /`;.`/ - ` : | | // \ \ `_. \_ __\ /__ _/ .-` / / // =====`-.____`.___ \_____/___.-`___.-'===== // ld pos[mxn], r[mxn]; stack < ii > st; ll n; ld sqr(ld x){ return x*x; } void solve(){ cin >> n; ffw(i,1,n) cin >> pos[i] >> r[i]; cout << setprecision(3) << fixed << r[1] << '\n'; st.push(ii(pos[1], r[1])); ffw(i,2,n){ while (sz(st)){ auto [POS,R] = st.top(); r[i] = min(r[i], sqr(POS - pos[i])/(4*R) ); if (r[i] > R) st.pop(); else break; } st.push(ii(pos[i], r[i])); cout << setprecision(3) << fixed << r[i] << '\n'; } } int main(){ fastio(); solve(); }

Compilation message (stderr)

bal.cpp:57:1: warning: multi-line comment [-Wcomment]
   57 | //                 / \|||  :  |||// \
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...