Submission #1023311

# Submission time Handle Problem Language Result Execution time Memory
1023311 2024-07-14T15:26:48 Z bad_in_physics Balloons (CEOI11_bal) C++17
50 / 100
2000 ms 12352 KB
//#pragma GCC optimize("O3,unroll-loops")

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<unordered_set>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<math.h>
#include<iomanip>
#include<array>
#include<climits>
//#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

#define ll long long
#define double long double
#define str string
#define ins insert
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sqr(x) (x)*(x)
 
using namespace std;
//using namespace __gnu_pbds;
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    int n;
    cin >> n;
    vector<double> x(n),r(n);
    for (int i=0; i<n; i++) {
        cin >> x[i] >> r[i];
    } vector<double> ans(n);
    ans[0]=r[0]; 
    for (int i=1; i<n; i++) {
        double fori=r[i];
        for (int j=0; j<i; j++) {
            fori=min(fori,(double)sqr(x[i]-x[j])/(double)(4*ans[j]));
        } ans[i]=fori;
    } for (int i=0; i<n; i++) {
        cout << ans[i];
        if (i<n-1) cout << "\n";
    }
}
 
int main() {
    //freopen("sleepy.in", "r", stdin);
    //freopen("sleepy.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tt=1;
    //cin >> tt;
    cout << fixed << setprecision(3);
    for (int i=1; i<=tt; i++) {
        //cout << "Case#" << i << ":\n";
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 13 ms 604 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 1277 ms 1644 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Execution timed out 2007 ms 3416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2069 ms 6492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2060 ms 7516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 9808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2052 ms 12352 KB Time limit exceeded
2 Halted 0 ms 0 KB -