답안 #698020

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698020 2023-02-11T23:00:39 Z yashsingh Balloons (CEOI11_bal) C++17
100 / 100
189 ms 10264 KB
#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef pair<int,ld> pld;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  cout << fixed << setprecision(10);
  int n;
  cin >> n;

  stack<pld> s;

  int x;
  ld r;
  vector<ld> ans(n);
  for (int i{0}; i < n; ++i) {
    cin >> x >> r;
    while (s.size()) {
      pld tp = s.top();
      r = min(r, (ld)pow(tp.first - x, 2.0L) / (4.0L * tp.second));
      if (r >= tp.second) {
        s.pop();
      } else {
        break;
      }
    }
    ans[i] = r;
    s.push({x, r});
  }

  for (auto &rad: ans) {
    cout << rad << "\n";
  }

  return 0;
}
# 결과 실행 시간 메모리 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 340 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB 2000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 1108 KB 20000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 2880 KB 50000 numbers
2 Correct 44 ms 2776 KB 49912 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 98 ms 5068 KB 100000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 113 ms 5964 KB 115362 numbers
2 Correct 136 ms 6100 KB 119971 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 161 ms 7644 KB 154271 numbers
2 Correct 175 ms 10092 KB 200000 numbers
# 결과 실행 시간 메모리 Grader output
1 Correct 189 ms 9164 KB 200000 numbers
2 Correct 172 ms 10264 KB 199945 numbers