답안 #961794

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
961794 2024-04-12T12:57:02 Z akkshaysr Balloons (CEOI11_bal) C++17
10 / 100
145 ms 9464 KB
#include <bits/stdc++.h>
#define fr first
#define se second
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define repr(i,a,b) for(int i = a; i > (b); --i)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define IN(i,l,r) (l<i&&i<r)
#define pb push_back
#define dbg(v) \
	cout << "Line(" << __LINE__ << ") -> " << #v << " = " << (v) << endl;
using namespace std;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
const int U = 2e5+2;
int n;
vi x,r;
vector<ld> final_r;

ld norm(int x1,int y1,int x2,int y2){
    return ((ld)x1 - x2)*((ld)x1 - x2) + ((ld)y1 - y2)*((ld)y1 - y2);
}

ld get_radius(int x1,int x2,ld r1){
    return norm(x1,0,x2,0)/(4*r1);
}

int main(){
	cin.tie(0)->sync_with_stdio(false);
    cin >> n;
    x = vi(n,0); r = vi(n,0); final_r = vector<ld>(n,0);
    rep(i,0,n){
        cin >> x[i] >> r[i];
    }
    stack<int> ib;
    rep(i,0,n){
        ld fr = r[i];
        while(
            !ib.empty() &&
            norm(x[i],fr,x[ib.top()],final_r[ib.top()]) <= (fr+final_r[ib.top()])*(fr+final_r[ib.top()])
        ){
            int j = ib.top(); ib.pop();
            fr = get_radius(x[i],x[j],final_r[j]);
        }
        final_r[i] = fr;
        ib.push(i);
    }
    cout << fixed << setprecision(3);
    for(auto r : final_r) cout << r << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB 2 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 1176 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 2652 KB 13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 66 ms 4948 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 5788 KB 4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 96 ms 7760 KB 1730th numbers differ - expected: '5.6890000000', found: '6.8060000000', error = '1.1170000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 145 ms 9464 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -