Submission #535739

# Submission time Handle Problem Language Result Execution time Memory
535739 2022-03-11T05:23:46 Z abc864197532 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define pii pair<int,int>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
void abc() {cout << endl;}
template <typename T, typename ...U> void abc(T i, U ...j) {
	cout << i << ' ', abc(j...);
}
template <typename T> void printv(T l, T r) {
	for (; l != r; ++l)
		cout << *l << " \n"[l + 1 == r];
}
#ifdef Doludu
#define test(x...) abc("[" + string(#x) + "]", x)
#define owo freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#else
#define test(x...) void(0)
#define owo ios::sync_with_stdio(false), cin.tie(0)
#endif

int main () {
	owo;
	int n;
	cin >> n;
	vector <int> a(n + 1), b(n);
	for (int i = 0; i <= n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i)
		cin >> b[i];
	sort(all(a)), sort(all(b));
	for (int k = 0; k <= n; ++k) {
		vector <int> c = a;
		c.erase(c.begin() + k);
		int ans = 0;
		for (int i = 0; i < n; ++i)
			ans = max(ans, c[i] - b[i]);
		cout << ans << " \n"[k == n];
	}
	/*
	vector <int> ans(n + 1);
	int now = 0;
	for (int i = 1; i <= n; ++i) {
		now = max(now, a[i - 1] - b[i - 1]);
		ans[i] = max(ans[i], now);
	}
	now = 0;
	for (int i = n - 1; i >= 0; --i) {
		now = max(now, a[i + 1] - b[i]);
		ans[i] = max(ans[i], now);
	}
	printv(all(ans));
	*/
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -