# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
648769 | wyhong3103 | Balloons (CEOI11_bal) | C++14 | 2072 ms | 12640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define all(x) begin(x),end(x)
#define fir first
#define sec second
#define sz(x) x.size()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int,int>;
using db = double;
using ldb = long double;
using pldb = pair<ldb, ldb>;
using pdb = pair<db,db>;
using pll = pair<ll,ll>;
using vll = vector<ll>;
const double EPS = (1e-6);
void setio(string s){
freopen((s + ".in").c_str(),"r",stdin);
freopen((s + ".out").c_str(),"w",stdout);
}
ldb dist(pldb a, pldb b){
return hypot(abs(a.fir-b.fir), abs(a.sec-b.sec));
}
void solve(){
int n;
cin >> n;
vector<pldb> a(n);
for(auto& i : a) cin >> i.fir >> i.sec;
vector<ldb> res(n);
//{loc, radius}, monotonic radius
stack<pldb> s;
for(int i{}; i < n; i++){
ldb cur_hi = a[i].sec;
while (!s.empty()){
ldb lo = 0, hi = cur_hi;
for(int j{}; j < 100; j++){
ldb mid = lo + (hi-lo)/2;
if (dist(s.top(), {a[i].fir, mid}) > mid+s.top().sec) lo = mid;
else hi = mid;
}
cur_hi = lo;
if (lo > s.top().sec){
s.pop();
}else break;
}
res[i] = cur_hi;
s.push({a[i].fir, cur_hi});
}
cout << setprecision(8) << fixed;
for(auto& i : res) cout << i << '\n';
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
while(t--){
solve();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |