Submission #201346

# Submission time Handle Problem Language Result Execution time Memory
201346 2020-02-10T08:58:20 Z Mamnoon_Siam Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
5 ms 376 KB
#include  <bits/stdc++.h>
using namespace std;

using ll = long long;
using ii = pair<int, int>;

const int maxn = 2e5 + 5;

int n;
int a[maxn], b[maxn], p[maxn], s[maxn];

int main(int argc, char const *argv[])
{
#ifdef LOCAL
	freopen("in", "r", stdin);
#endif
	cin >> n;
	for(int i = 1; i <= n+1; i++) {
		cin >> a[i];
	}
	for(int i = 1; i <= n; i++) {
		cin >> b[i];
	}
	sort(a + 1, a + 2 + n);
	sort(b + 1, b + 1 + n);
	for(int i = n+1; i > 1; i--) {
		s[i] = max(s[i+1], a[i] - b[i-1]);
	}
	for(int i = 1; i <= n; i++) {
		p[i] = max(p[i-1], a[i] - b[i]);
	}
	for(int i = 1; i <= n+1; i++) {
		cout << max(p[i-1], s[i+1]) << ' ';
	} cout << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -