답안 #1063641

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1063641 2024-08-17T21:54:53 Z daviedu Balloons (CEOI11_bal) C++17
10 / 100
108 ms 14676 KB
#include <bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define ld long double

struct P{
    ll x, y;
};

void dbg_out() { cerr << endl; }
template <typename H, typename... T>
void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); }
#define dbg(...) { cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); }

const ld prec = 0.0001;
ld max_r(ll a, ll b, ld R){
    return (a-b)*(a-b) / (4*R);
}

signed main(){
    fastio;
    int n;
    cin >> n;
    vector<pair<int, ld>> arr (n);
    for (int i=0; i<n; i++){
        cin >> arr[i].first >> arr[i].second;
    }
    vector<ld> ans (n);
    stack<int> can_touch;
    for (int i=0; i<n; i++){
        auto [x, r] = arr[i];
        ld best=r;
        while (!can_touch.empty()){
            int X = arr[can_touch.top()].first;
            ld R = ans[can_touch.top()];
            
            // touches
            if (best >= max_r(x, X, R)){
                best = max_r(x, X, R);
                if (best >= R) can_touch.pop();
                else break;
            }
            else break;
        }
        ans[i] = best;
        can_touch.push(i);
    }
    cout << fixed << setprecision(3);
    for (int i=0; i<n; i++) cout << ans[i] << ' ';
    cout << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB 2 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 600 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1880 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 3940 KB 13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 7760 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 66 ms 9040 KB 4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 87 ms 11800 KB 1734th numbers differ - expected: '1856.0220000000', found: '1865.0000000000', error = '8.9780000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 108 ms 14676 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -