# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
117641 |
2019-06-17T03:39:02 Z |
JohnTitor |
Balloons (CEOI11_bal) |
C++11 |
|
201 ms |
13192 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
512 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1536 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
3824 KB |
50000 numbers |
2 |
Correct |
40 ms |
3612 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
7016 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
131 ms |
7920 KB |
115362 numbers |
2 |
Correct |
90 ms |
8184 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
181 ms |
10100 KB |
154271 numbers |
2 |
Correct |
145 ms |
13176 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
201 ms |
12444 KB |
200000 numbers |
2 |
Correct |
146 ms |
13192 KB |
199945 numbers |