Submission #1119479

# Submission time Handle Problem Language Result Execution time Memory
1119479 2024-11-27T05:10:41 Z Miquella_ Balloons (CEOI11_bal) C++14
0 / 100
159 ms 29400 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define S second
#define F first
#define all(x) (x).begin(), (x).end()
#define el "\n"
#define fo(i,a,b) for(int i =a;i<=b;i++)
#define fo1(i,a,b) for(int i =a;i>=b;i--)
#define bit(mask,i) ((mask>>i)&1)
#define pi pair<ll,ll>
#define NAME ""
using namespace std;

const int MAXN = 1e6+5;
const ll MOD = 1e9+7;
const int maxp = 2e7;

double n,a[MAXN],res,m,k,t,r[MAXN];
vector<ll> adj[MAXN];
deque<ll> deq;

double maxRadius(double x,double y,double x1) {
    return ((x-x1)*(x-x1)) / (4*y);
}

void inp() {
    cin >> n;
    fo(i,1,n){
        cin >> a[i] >> r[i];
    }
}

void solve() {
    fo(i,1,n) {
        while(!deq.empty() && r[deq.front()]<= r[i])deq.pop_front();
        double temp = r[i];
//        if(!deq.empty())cout << maxRadius(a[deq.front()],r[deq.front()], a[i])<< el;
        if(!deq.empty()) temp = min(temp,maxRadius(a[deq.front()],r[deq.front()], a[i]));
        deq.push_back(i);
        r[i]=temp;
        cout << setprecision(3)<<fixed << r[i] << el;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    freopen(NAME".INP", "r", stdin);
//    freopen(NAME".OUT", "w", stdout);
    inp();
    solve();
    return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 23888 KB 4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 23888 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 24000 KB 6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 23792 KB 2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 24400 KB 2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 49 ms 25456 KB 2nd numbers differ - expected: '15398.0000000000', found: '24984.0000000000', error = '9586.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 106 ms 26696 KB 2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 27288 KB 2nd numbers differ - expected: '5059.0000000000', found: '5060.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 129 ms 28428 KB 2nd numbers differ - expected: '1873.0000000000', found: '1874.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 159 ms 29400 KB 2nd numbers differ - expected: '2961.0000000000', found: '2962.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -