답안 #755208

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755208 2023-06-09T15:07:46 Z farica Balloons (CEOI11_bal) C++14
0 / 100
567 ms 5920 KB
#include <bits/stdc++.h>
#define ll long long

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;

const int INF = 1e9;
const int MX = 5e5 + 23;
const int MOD = 1e9+7;
const int MAX_N = 1e6;
const int MAX_N2 = 1e5;
const int TWO_MOD_INV = 500000004;
const int M = 998244353;

bool intersect(int x1, int r1, int x2, int r2) {
    if(sqrt((x1-x2)*(x1-x2)+(r1-r2)*(r1-r2))<=(r1+r2)) return 1;
    return 0;
}

void solve() {
    int n;
    cin >> n;
    int x[n];
    long double r[n];
    stack<int>s;
    for(int i=0; i<n; ++i) {
        cin >> x[i] >> r[i];
        if(!i) {
            s.push(i);
            cout << fixed << setprecision(3) << r[i] << endl;
            continue;
        }
        while(!s.empty()) {
            int cur=s.top();
            if(intersect(x[i], r[i], x[cur], r[cur])) {
                r[i]=((x[i]-x[cur])*(x[i]-x[cur]))/(4*r[cur]);
            } else break;
            s.pop();
        }
        cout << fixed << setprecision(3) << r[i] << endl;
        s.push(i);
    }
}

signed main()
{

    //freopen("mootube.in","r",stdin);
    //freopen("mootube.out","w",stdout);

    int t=1;
    while(t--) solve();

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 212 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 352 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 58 ms 740 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 147 ms 1720 KB 11th numbers differ - expected: '15389.0000000000', found: '8577.5010000000', error = '6811.4990000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 287 ms 3160 KB 53rd numbers differ - expected: '7879.0000000000', found: '736.9000000000', error = '7142.1000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 368 ms 3536 KB 117th numbers differ - expected: '4932.0000000000', found: '2934.0710000000', error = '1997.9290000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 469 ms 4716 KB 612th numbers differ - expected: '1218.0660000000', found: '1219.0000000000', error = '0.9340000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 567 ms 5920 KB 481st numbers differ - expected: '2432.0110000000', found: '2433.0000000000', error = '0.9890000000'
2 Halted 0 ms 0 KB -