답안 #549591

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549591 2022-04-16T05:19:19 Z Jomnoi Balloons (CEOI11_bal) C++17
100 / 100
223 ms 5436 KB
#include <bits/stdc++.h>
#define DEBUG 0
using namespace std;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin >> n;
    stack <pair <double, double>> stk;
    for(int i = 1; i <= n; i++) {
        double x, r, nr;
        cin >> x >> r;
        
        while(!stk.empty() and (r = min(r, (stk.top().first - x) * (stk.top().first - x) / (4 * stk.top().second))) >= stk.top().second) {
            stk.pop();
        }
        stk.emplace(x, r);
        
        cout << fixed << setprecision(3) << r << '\n';
    }
    return 0;
}

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:11:22: warning: unused variable 'nr' [-Wunused-variable]
   11 |         double x, r, nr;
      |                      ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB 2 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB 2000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 596 KB 20000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 1612 KB 50000 numbers
2 Correct 54 ms 1656 KB 49912 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 1996 KB 100000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 135 ms 2256 KB 115362 numbers
2 Correct 133 ms 3392 KB 119971 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 2536 KB 154271 numbers
2 Correct 213 ms 5436 KB 200000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 223 ms 2764 KB 200000 numbers
2 Correct 212 ms 5328 KB 199945 numbers