답안 #872456

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
872456 2023-11-13T06:52:02 Z sleepntsheep Balloons (CEOI11_bal) C++17
0 / 100
2000 ms 4368 KB
#include <iostream>
#include <iomanip> 
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>

using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
#define N 200005

int n, x[N];
f80 r[N];

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

    deque<int> q;

    for (int st = 0, i = 1; i < n; ++i)
    {
        f80 l = 0, r = ::r[i], iter = 50;
        for (; iter--;)
        {
            f80 m = (l+r)/2, ok = 1;
            for (auto it = q.rbegin(); ok and it != q.rend(); ++it)
            {
                int j = *it;
                f80 A = 1L * x[i] * x[i] + 1L * x[j] * x[j] - 2L * x[i] * x[j] - 4L * ::r[j] * m;
                if (A < 0) ok = 0;
            }
            if (ok) l = m;
            else r = m;
        }

        ::r[i] = l;
        while (q.size() && ::r[q.back()] <= ::r[i]) q.pop_back();
        q.push_back(i);
    }

    cout << fixed << setprecision(3);
    for (int i = 0; i < n; ++i)
        cout << r[i] << '\n';

    return 0;
}


Compilation message

bal.cpp: In function 'int main()':
bal.cpp:33:14: warning: unused variable 'st' [-Wunused-variable]
   33 |     for (int st = 0, i = 1; i < n; ++i)
      |              ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 2nd numbers differ - expected: '4.1670000000', found: '7.0000000000', error = '2.8330000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 2nd numbers differ - expected: '0.0010000000', found: '3.0000000000', error = '2.9990000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 348 KB 2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 429 ms 2776 KB 2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2094 ms 3148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2054 ms 3100 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2055 ms 3164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2058 ms 3488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2061 ms 4368 KB Time limit exceeded
2 Halted 0 ms 0 KB -