답안 #755224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755224 2023-06-09T15:30:10 Z farica Balloons (CEOI11_bal) C++14
20 / 100
599 ms 7680 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();
            r[i]=min(r[i],((x[i]-x[cur])*(x[i]-x[cur]))/(4*r[cur]));
            if(r[i]>=r[cur]) {
                s.pop();
                continue;
            }
            else break;
        }
        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 Correct 1 ms 212 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.9330000000', error = '252735384.5049999952'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 352 KB 506th numbers differ - expected: '365.0000000000', found: '-2481854.0649999999', error = '2482219.0649999999'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 1012 KB 655th numbers differ - expected: '591.0000000000', found: '-2402336.3029999998', error = '2402927.3029999998'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 157 ms 1800 KB 4th numbers differ - expected: '15396.0000000000', found: '-8148.5510000000', error = '23544.5510000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 306 ms 3660 KB 7234th numbers differ - expected: '7160.0000000000', found: '-2398141.9989999998', error = '2405301.9989999998'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 380 ms 4056 KB 4643rd numbers differ - expected: '2427.0000000000', found: '-2355611.7020000000', error = '2358038.7020000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 509 ms 5664 KB 1734th numbers differ - expected: '1856.0220000000', found: '-2324667.3859999999', error = '2326523.4079999998'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 599 ms 7680 KB 2723rd numbers differ - expected: '859.0470000000', found: '-2333711.4849999999', error = '2334570.5319999997'
2 Halted 0 ms 0 KB -