Submission #531408

# Submission time Handle Problem Language Result Execution time Memory
531408 2022-02-28T15:52:56 Z Cantfindme Balloons (CEOI11_bal) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()

typedef long double ld;

const int maxn = 200010;
const int INF = LLONG_MAX/2;
const int mod = 1e9+7;

int n;
ld x[maxn], r[maxn];

int32_t main() {
	FAST
	#ifndef ONLINE_JUDGE
		ifstream cin("input.txt");
	#endif

	cin >> n;
	for (int i =1;i<=n;i++) cin >> x[i] >> r[i];

	stack <pi> s;
	for (int i =1;i<=n;i++) {
		if (s.empty()) {
			s.push(pi(x[i], r[i]));
		} else {
			while (true) {
				auto [xp, rp] = s.top(); 
				r[i] = min(r[i], (x[i] - xp) * (x[i] - xp) / (4 * rp));
				if (r[i] >= rp) s.pop();
				else break;
			}
			s.push(pi(x[i], r[i]));
		}
	}

	for (int i =1;i<=n;i++) cout << fixed << setprecision(6) << r[i] << "\n";

}


# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -