Submission #117641

#TimeUsernameProblemLanguageResultExecution timeMemory
117641JohnTitorBalloons (CEOI11_bal)C++11
100 / 100
201 ms13192 KiB
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k) for(int i=(j); i<=(k); i++) #define FFOR(i, j, k) for(int i=(j); i<(k); i++) #define DFOR(i, j, k) for(int i=(j); i>=(k); i--) #define bug(x) cerr<<#x<<" = "<<(x)<<'\n' #define pb push_back #define mp make_pair #define setbit(s, i) (s|=(1LL<<(i))) #define bit(s, i) (((s)>>(i))&1LL) #define mask(i) ((1LL<<(i))) #define builtin_popcount __builtin_popcountll using ll=long long; using ld=long double; template <typename T> inline void read(T &x){ char c; bool nega=0; while((!isdigit(c=getchar()))&&(c!='-')); if(c=='-'){ nega=1; c=getchar(); } x=c-48; while(isdigit(c=getchar())) x=x*10+c-48; if(nega) x=-x; } template <typename T> inline void writep(T x){ if(x>9) writep(x/10); putchar(x%10+48); } template <typename T> inline void write(T x){ if(x<0){ putchar('-'); x=-x; } writep(x); } template <typename T> inline void writeln(T x){ write(x); putchar('\n'); } #define taskname "Balloons" #define sqr(x) ((x)*(x)) int n; vector <pair <ld, ld>> good; ld get_r(ld x, ld x0, ld r0){ return sqr(x-x0)/(r0*4); } ld x[200001]; ld r[200001]; vector <pair <ld, ld>> s; int main(){ #ifdef Uiharu if(fopen(taskname".in", "r")) freopen(taskname".in", "r", stdin); #endif // Uiharu read(n); FOR(i, 1, n){ read(x[i]); read(r[i]); while(!s.empty()){ r[i]=min(r[i], get_r(x[i], s.back().first, s.back().second)); if(r[i]>=s.back().second) s.pop_back(); else break; } s.pb(mp(x[i], r[i])); cout<<setprecision(10)<<fixed<<r[i]<<'\n'; } }
#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...