Submission #969168

# Submission time Handle Problem Language Result Execution time Memory
969168 2024-04-24T15:55:09 Z yellowtoad Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 4444 KB
#include <iostream>
#include <algorithm>
#define f first
#define s second
using namespace std;

long long n, b[200010], maxx[200010], maxxx, ans[200010];
pair<long long,int> a[200010];

int main() {
	cin >> n;
	for (int i = 1; i <= n+1; i++) {
		cin >> a[i].f;
		a[i].s = i;
	}
	for (int i = 1; i <= n; i++) cin >> b[i];
	sort(a+1,a+n+2);
	sort(b+1,b+n+1);
	for (int i = n; i >= 1; i--) maxx[i] = max(maxx[i+1],abs(a[i+1].f-b[i]));
	for (int i = 1; i <= n+1; i++) {
		ans[a[i].s] = max(maxxx,maxx[i]);
		maxxx = max(maxxx,abs(a[i].f-b[i]));
	}
	for (int i = 1; i <= n+1; i++) cout << ans[i] << " ";
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 1 ms 4444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 1 ms 4444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 1 ms 4444 KB Output isn't correct
3 Halted 0 ms 0 KB -