답안 #755207

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755207 2023-06-09T15:06:54 Z farica Balloons (CEOI11_bal) C++14
0 / 100
581 ms 8596 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);
            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 1st numbers differ - expected: '24.0000000000', found: '4.1670000000', error = '19.8330000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 1st numbers differ - expected: '247294217.0000000000', found: '1000000000.0000000000', error = '752705783.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 300 KB 1st numbers differ - expected: '213.0000000000', found: '0.0010000000', error = '212.9990000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 340 KB 1st numbers differ - expected: '123.0000000000', found: '122.0020000000', error = '0.9980000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 54 ms 972 KB 1st numbers differ - expected: '213.0000000000', found: '212.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 140 ms 2396 KB 1st numbers differ - expected: '15399.0000000000', found: '15398.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 274 ms 4608 KB 1st numbers differ - expected: '7938.0000000000', found: '7937.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 326 ms 5324 KB 1st numbers differ - expected: '5060.0000000000', found: '5059.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 448 ms 7036 KB 1st numbers differ - expected: '1874.0000000000', found: '1873.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 581 ms 8596 KB 1st numbers differ - expected: '2962.0000000000', found: '2961.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -