Submission #260357

# Submission time Handle Problem Language Result Execution time Memory
260357 2020-08-10T06:49:25 Z sahil_k Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
1 ms 384 KB
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
#define MAXN 200005
int n;
int a[MAXN], b[MAXN];
int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i=0; i<=n; i++) {
		cin >> a[i];
	}
	sort(a, a+n+1);
	for (int i=0; i<n; i++) {
		cin >> b[i];
	}
	sort(b, b+n);
	multiset<int> cur;
	for (int i=1; i<=n; i++) {
		cur.insert(max(0, a[i]-b[i-1]));
	}
	cout << *prev(cur.end()) << " ";
	for (int i=0; i<n; i++) {
		cur.erase(cur.find(max(0, a[i+1]-b[i])));
		cur.insert(max(0, a[i]-b[i]));
		cout << *prev(cur.end()) << " ";
	}
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -