답안 #755222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755222 2023-06-09T15:28:28 Z farica Balloons (CEOI11_bal) C++14
20 / 100
612 ms 7608 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();
            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 6 ms 340 KB 506th numbers differ - expected: '365.0000000000', found: '-2481854.0649999999', error = '2482219.0649999999'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 65 ms 1048 KB 655th numbers differ - expected: '591.0000000000', found: '-2402336.3029999998', error = '2402927.3029999998'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 147 ms 1836 KB 250th numbers differ - expected: '15134.0000000000', found: '-10429.6650000000', error = '25563.6650000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 304 ms 3740 KB 7234th numbers differ - expected: '7160.0000000000', found: '-2398141.9989999998', error = '2405301.9989999998'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 375 ms 4180 KB 4643rd numbers differ - expected: '2427.0000000000', found: '-2355611.7020000000', error = '2358038.7020000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 548 ms 5516 KB 1734th numbers differ - expected: '1856.0220000000', found: '-2324667.3859999999', error = '2326523.4079999998'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 612 ms 7608 KB 2723rd numbers differ - expected: '859.0470000000', found: '-2333711.4849999999', error = '2334570.5319999997'
2 Halted 0 ms 0 KB -