답안 #356778

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
356778 2021-01-23T16:34:44 Z jnk Balloons (CEOI11_bal) C++17
0 / 100
297 ms 9452 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

double x[200005], r[200005], res[200005];
int main(){
    
    cout.sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;
    for(int i = 0; i < n; i++)
        cin >> x[i] >> r[i];
    

    res[0] = r[0];
    stack<pair<double,double>> st;
    st.push(make_pair(x[0], res[0]));

    for(int i = 1; i < n; i++){
        double esq = 0, dir = r[i];
        for(int j = 0; j < 50; j++){
            double r = (esq + dir)/2;
            int ok = 1;
            while(!st.empty()){
                auto p = st.top();
                double xdif = x[i] - p.first;
                double ydif = r - p.second;
                double dist = r+p.second;
                if(xdif*xdif + ydif*ydif < dist*dist)
                    ok = 0;
                if(r > p.second) st.pop();
                else break;
            }
            if(ok) esq = r;
            else dir = r;
        }
        res[i] = esq;
        st.push(make_pair(x[i], res[i]));
    }

    for(int i = 0; i < n; i++)
        printf("%.3f\n", res[i]);

	return 0;
}

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:42:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   42 |     for(int i = 0; i < n; i++)
      |     ^~~
bal.cpp:45:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   45 |  return 0;
      |  ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 5th numbers differ - expected: '17.1630000000', found: '49.5000000000', error = '32.3370000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 2nd numbers differ - expected: '252735385.4379999936', found: '500000000.0000000000', error = '247264614.5620000064'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 6th numbers differ - expected: '213.0000000000', found: '223.1250000000', error = '10.1250000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 492 KB 8th numbers differ - expected: '114.0020000000', found: '115.1720000000', error = '1.1700000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 1260 KB 4th numbers differ - expected: '210.0010000000', found: '211.3360000000', error = '1.3350000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 78 ms 2636 KB 2nd numbers differ - expected: '15398.0000000000', found: '18738.0000000000', error = '3340.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 151 ms 4972 KB 2nd numbers differ - expected: '7937.0000000000', found: '9058.0000000000', error = '1121.0000000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 180 ms 5996 KB 8th numbers differ - expected: '5051.0000000000', found: '5052.5320000000', error = '1.5320000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 231 ms 7660 KB 4th numbers differ - expected: '1871.0000000000', found: '1872.1700000000', error = '1.1700000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 297 ms 9452 KB 5th numbers differ - expected: '2958.0000000000', found: '2959.1070000000', error = '1.1070000000'
2 Halted 0 ms 0 KB -