Submission #946491

# Submission time Handle Problem Language Result Execution time Memory
946491 2024-03-14T17:17:13 Z MinaRagy06 Measures (CEOI22_measures) C++17
0 / 100
1500 ms 1376 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n, m, d;
	cin >> n >> m >> d;
	int a[n];
	vector<int> v;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		v.push_back(a[i]);
	}
	int b[m];
	for (int i = 0; i < m; i++) {
		cin >> b[i];
		v.push_back(b[i]);
		sort(v.begin(), v.end());
		double l = 0, r = 1e18;
		for (int _ = 0; _ < 100; _++) {
			double md = (l + r) / 2;
			double lst = -1e18;
			bool ok = 1;
			for (auto x : v) {
				lst = max(lst + d, x - md);
				if (lst > x + md) {
					ok = 0;
					break;
				}
			}
			if (ok) {
				r = md;
			} else {
				l = md;
			}
		}
		string s = to_string(l);
		while (s.back() == '0') s.pop_back();
		if (s.back() == '.') s.pop_back();
		cout << s << ' ';
	}
	cout << '\n';
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Incorrect 6 ms 344 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Incorrect 6 ms 344 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1525 ms 1376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1525 ms 1376 KB Time limit exceeded
2 Halted 0 ms 0 KB -