답안 #988842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988842 2024-05-26T12:46:56 Z _callmelucian Balloons (CEOI11_bal) C++14
0 / 100
2000 ms 9296 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tt;

#define all(a) a.begin(), a.end()
#define filter(a) a.erase(unique(all(a)), a.end())

const ld INF = 1e18;
const ld eps = 1e-12;
const int mn = 2e5 + 5;

ll x[mn], maxR[mn];
ld rad[mn];

bool ok (int j, int i, ld tryR) {
    ld tmp = (x[i] - x[j]) * (x[i] - x[j]);
    return tmp - 4 * rad[j] * tryR >= -eps;
}

ld calc (int j, int i, ld L = 0, ld R = INF) {
    if (abs(L - R) < eps) return L;
    ld mid = (L + R) / 2;
    if (ok(j, i, mid + eps)) return calc(j, i, mid + eps, R);
    return calc(j, i, L, mid);
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> x[i] >> maxR[i];
    rad[1] = maxR[1];

    cout << fixed << setprecision(9) << rad[1] << "\n";

    stack<int> st; st.push(1);
    for (int i = 2; i <= n; i++) {
        rad[i] = INF;
        int j = -1;
        while (st.size()) {
            j = st.top();
            ld cur = calc(j, i, 0, maxR[i]);
            if (cur <= rad[i]) {
                rad[i] = cur;
                st.pop();
            }
            else break;
        }
        st.push(j); st.push(i);

        cout << rad[i] << "\n";
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2076 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 8th numbers differ - expected: '0.3800000000', found: '9.0000000000', error = '8.6200000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 348 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 1116 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 95 ms 4180 KB 13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 206 ms 4844 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 244 ms 5716 KB 4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 313 ms 7504 KB 1730th numbers differ - expected: '5.6890000000', found: '6.8055555560', error = '1.1165555560'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 375 ms 9296 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -