답안 #484265

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484265 2021-11-02T18:08:32 Z Olympia Balloons (CEOI11_bal) C++17
100 / 100
266 ms 13932 KB
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <set>
#include <iomanip>
#define ll long long
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<double> x(n), r(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> r[i];
    }
    stack<int> indices;
    indices.push(0);
    for (int i = 1; i < n; i++) {
        while(!indices.empty()) {
            int j = indices.top();
            double val = ((x[i] - x[j]) * (x[i] - x[j])) / (4.0 * r[j]);
            r[i] = min(r[i], val);
            if (r[i] >= r[j]) {
                indices.pop();
            } else {
                break;
            }
        }
        indices.push(i);
    }
    for (double d: r) {
        cout << setprecision(30) << d << "\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB 2 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB 2000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 1164 KB 20000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 81 ms 2508 KB 50000 numbers
2 Correct 77 ms 3612 KB 49912 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 4596 KB 100000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 161 ms 5308 KB 115362 numbers
2 Correct 134 ms 8476 KB 119971 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 212 ms 6856 KB 154271 numbers
2 Correct 266 ms 13932 KB 200000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 265 ms 8964 KB 200000 numbers
2 Correct 222 ms 13924 KB 199945 numbers