Submission #134406

# Submission time Handle Problem Language Result Execution time Memory
134406 2019-07-22T16:16:04 Z Milki Balloons (CEOI11_bal) C++14
30 / 100
288 ms 11032 KB
#include<bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef long double ld;
typedef pair<ld, ld> point;

const int MAXN = 2e5 + 5;
const ld eps = 1e-6;

int n;
ld x[MAXN], r[MAXN];
stack <point> stek;

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

  cin >> n;
  REP(i, n){
    cin >> x[i] >> r[i];
    ld radijus = r[i];

    while(sz(stek)){
      ld xx = stek.top().first - x[i];
      xx *= xx;
      radijus = min(radijus, ( xx ) / ((ld)4 * stek.top().second));

      if(radijus > stek.top().second - eps)
        stek.pop();
      else{
        cout << setprecision(3) << fixed << radijus << "\n";
        stek.push(point(x[i], radijus));
        break;
      }
    }
    if(!sz(stek)){
      cout << setprecision(3) << fixed << radijus << "\n";
      stek.push(point(x[i], r[i]));
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 508 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB 8th numbers differ - expected: '0.3800000000', found: '0.3400000000', error = '0.0400000000'
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 1380 KB 2954th numbers differ - expected: '267.9930000000', found: '58.1120000000', error = '209.8810000000'
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 3416 KB 14055th numbers differ - expected: '15399.0000000000', found: '15379.0260000000', error = '19.9740000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 6124 KB 7288th numbers differ - expected: '7939.1490000000', found: '7931.0080000000', error = '8.1410000000'
# Verdict Execution time Memory Grader output
1 Incorrect 176 ms 7068 KB 4716th numbers differ - expected: '5060.5780000000', found: '5034.1380000000', error = '26.4400000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 242 ms 9064 KB 1773rd numbers differ - expected: '0.1050000000', found: '0.1030000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 288 ms 11032 KB 2791st numbers differ - expected: '0.1790000000', found: '0.1770000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -