Submission #1108149

# Submission time Handle Problem Language Result Execution time Memory
1108149 2024-11-03T03:37:15 Z vjudge1 Balloons (CEOI11_bal) C++17
100 / 100
1647 ms 3632 KB
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  vector<pair<int, double>> bals;
  int n, x, r;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x >> r;
    double ans = r;
    for (auto& bal : bals) {
      double rtmp = 1.0 * (x - bal.first) * (x - bal.first) / 4 / bal.second;
      ans = min(ans, rtmp);
    }
    while (bals.size() > 0 && ans >= bals.back().second) {
      bals.pop_back();
    }
    cout << fixed << setprecision(3) << ans << endl;
    bals.push_back({x, ans});
  }

  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 336 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 55 ms 584 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 657 ms 1744 KB 50000 numbers
2 Correct 349 ms 768 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 1063 ms 1476 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 1485 ms 1688 KB 115362 numbers
2 Correct 855 ms 2564 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 1647 ms 3152 KB 154271 numbers
2 Correct 1414 ms 1476 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 820 ms 3632 KB 200000 numbers
2 Correct 1426 ms 1632 KB 199945 numbers