Submission #319517

# Submission time Handle Problem Language Result Execution time Memory
319517 2020-11-05T13:17:44 Z mariowong Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define pbb pair<bool,bool>
#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define xmod (ll)(1e9+9) 
#define hmod 1286031825167LL
using namespace std;

int n,a[200005],b[200005],mxr[200005],mxl[200005]; 
int main(){	
	ios::sync_with_stdio(false);
	cin >> n; n++;
	for (int i=1;i<=n;i++){
		cin >> a[i];
	}
	for (int i=1;i<n;i++){
		cin >> b[i];
	}
	sort(a+1,a+1+n); sort(b+1,b+n);
	for (int i=1;i<n;i++){
		mxl[i]=max(mxl[i-1],a[i]-b[i]);
	}
	for (int i=2;i<=n;i++){
		mxr[i]=a[i]-b[i-1];
	}
	for (int i=n-1;i>=1;i--){
		mxr[i]=max(mxr[i+1],mxr[i]);
	}
	for (int i=1;i<=n;i++){
		cout << max(mxl[i-1],mxr[i+1]);
		if (i < n)
		cout << " ";
	}
	cout << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -