Submission #488007

# Submission time Handle Problem Language Result Execution time Memory
488007 2021-11-17T11:55:21 Z s_samchenko Balloons (CEOI11_bal) C++17
50 / 100
2000 ms 7624 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define int ll
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define pii pair <int, int>
#define pdd pair <double, double>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int inf = 1e15;
const int mod = 1e9+7;
const int N = 1e6+100, C = 330;

void solve(){
	int n;
	cin >> n;
	vector <int> x(n), r(n);
	for (int i = 0; i < n; ++i) cin >> x[i] >> r[i];
	
	vector <double> ans(n);
	for (int i = 0; i < n; ++i){
		double res = r[i];
		for (int j = i-1; j >= 0; --j){
			double cur = (x[i] - x[j]) * (x[i] - x[j]);
			cur /= 4 * ans[j];
			res = min(res, cur);
		}
		ans[i] = res;
	}
	for (auto i : ans) cout << fixed << setprecision(10) << i << '\n';
}

signed main(){
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int tt = 1;
	//cin >> tt;
	while (tt--){
		solve();
		cout << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 6 ms 336 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 313 ms 1280 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Execution timed out 2016 ms 2972 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2079 ms 4032 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 4680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2064 ms 6088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2095 ms 7624 KB Time limit exceeded
2 Halted 0 ms 0 KB -