Submission #1023312

# Submission time Handle Problem Language Result Execution time Memory
1023312 2024-07-14T15:27:27 Z bad_in_physics Balloons (CEOI11_bal) C++17
50 / 100
2000 ms 9804 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 344 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 12 ms 344 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 1341 ms 1420 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Execution timed out 2055 ms 2652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2033 ms 4952 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2079 ms 5716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2058 ms 7508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 9804 KB Time limit exceeded
2 Halted 0 ms 0 KB -