Submission #210146

# Submission time Handle Problem Language Result Execution time Memory
210146 2020-03-16T16:20:35 Z AMO5 Just Long Neckties (JOI20_ho_t1) C++
0 / 100
5 ms 380 KB
#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	ll 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(a,a+n+1);
	sort(b,b+n);
	for(int i = 0; i < n+1; i++){
		ll cnt = 0;
		for(int j = 0; j < n; j++){
			if(i==j)continue;
			if(j<i)
				cnt = max(a[j]-b[j],cnt);
			else 
				cnt = max(a[j]-b[j-1],cnt);
		}
		cout << cnt << ' ';
	}
	cout << endl;
}	
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -