Submission #1020037

# Submission time Handle Problem Language Result Execution time Memory
1020037 2024-07-11T13:09:23 Z julia_08 Balloons (CEOI11_bal) C++17
100 / 100
149 ms 5528 KB
#include <bits/stdc++.h>
using namespace std;

using ld = long double;

ld solve(ld x1, ld x2, ld r2){
  return ((x2 - x1)*(x2 - x1))/(4*r2);
}

int main(){
  cin.tie(0)->sync_with_stdio(0);

  int n; cin >> n;

  stack<pair<ld, ld>> q;

  for(int i=1; i<=n; i++){
    ld x, r; cin >> x >> r;
    while(!q.empty()){
      r = min(r, solve(x, q.top().first, q.top().second));

      if(q.top().second > r) break;
      q.pop();
    }

    cout << fixed << setprecision(3) << r << "\n";
    q.push({x, r});
  }

  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 14 ms 860 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1840 KB 50000 numbers
2 Correct 33 ms 1736 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 72 ms 2896 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 83 ms 3412 KB 115362 numbers
2 Correct 76 ms 3408 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 122 ms 4176 KB 154271 numbers
2 Correct 149 ms 5528 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 138 ms 4688 KB 200000 numbers
2 Correct 127 ms 5460 KB 199945 numbers