이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
int pila[n];
long double x[n];
long double r[n];
long double ans[n];
for(int i=0;i<n;i++){
cin >> x[i] >> r[i];
}
pila[0] =0;
int index = 0;
for(int i=0;i<n;i++){
if(i==0){
ans[0] = r[0];
}
else{
bool first = true;
long double k;
while (index >= 0){
if(first){
k = min(r[i],((x[i]-x[pila[index]])/(4*ans[pila[index]]))*(x[i]-x[pila[index]]));
first = false;
}
else{
k = min(k,((x[i]-x[pila[index]])/(4*ans[pila[index]]))*(x[i]-x[pila[index]]));
}
if(k<=ans[index]){
break;
}
pila[index] = 0;
index--;
}
ans[i] = k;
pila[index+1] = i;
index++;
}
cout << fixed << setprecision(6) << ans[i] << "\n";
}
return 0;
}
# | 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... |