# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
543230 |
2022-03-29T21:20:10 Z |
perchuts |
Balloons (CEOI11_bal) |
C++17 |
|
223 ms |
13700 KB |
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define pb push_back
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ii = pair<int,int>;
using iii = tuple<int,int,int>;
const int inf = 2e9+1;
const int mod = 1e9+7;
const int maxn = 2e5+100;
template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }
long double v[maxn], r[maxn], resp[maxn];
long double compute(int i,int j){
return min((v[i]-v[j])*(v[i]-v[j])/(4*resp[j]),r[i]);
}
int main(){_
int n;cin>>n;
for(int i=1;i<=n;++i)cin>>v[i]>>r[i];
stack<int>st;
for(int i=1;i<=n;++i){
double cur = r[i];
while(!st.empty()){
ckmin(cur,compute(i,st.top()));
if(resp[st.top()]>=cur)break;
else st.pop();
}
resp[i] = cur;
st.push(i);
}
for(int i=1;i<=n;++i)cout<<fixed<<setprecision(3)<<resp[i]<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
328 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
468 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
1620 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
3704 KB |
50000 numbers |
2 |
Correct |
55 ms |
4036 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
6832 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
128 ms |
7648 KB |
115362 numbers |
2 |
Correct |
115 ms |
8236 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
204 ms |
10120 KB |
154271 numbers |
2 |
Correct |
196 ms |
13700 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
223 ms |
12220 KB |
200000 numbers |
2 |
Correct |
196 ms |
12540 KB |
199945 numbers |