#include<bits/stdc++.h>
#define int long long
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_multiset tree<long long, null_type,less_equal<long long>, rb_tree_tag,tree_order_statistics_node_update>
//#define ordered_set tree<long long, null_type,less<long long>, rb_tree_tag,tree_order_statistics_node_update>
//st.order_of_key
//st.find_by_order
main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
vector<int> x(n+1),h(n+1);
for(int i=1;i<=n;++i){
cin>>x[i]>>h[i];
}
vector<int> v;
vector<double> r(n+1);
double eps=1e-3;
for(int i=1;i<=n;++i){
r[i]=h[i];
for(int j:v){
if(r[i]>(x[i]-x[j])*(x[i]-x[j])/(4*r[j])+eps){
r[i]=(x[i]-x[j])*(x[i]-x[j])/(4*r[j]);
}
}
cout<<fixed<<setprecision(3)<<r[i]<<"\n";
if(i<n){
while(v.size() && r[i]>r[v.back()]-eps){
v.pop_back();
}
v.push_back(i);
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
bal.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
17 | main(){
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |