Submission #941866

# Submission time Handle Problem Language Result Execution time Memory
941866 2024-03-09T15:27:40 Z Litusiano Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
391 ms 412 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
	int n; cin>>n;
	vector<int> v(n+1); for(int& i : v) cin>>i;
	vector<int> b(n); for(int& i : b) cin>>i;
	sort(v.begin(),v.end()); sort(b.begin(),b.end());
	for(int i = 0; i<=n; i++){
		vector<int> v1;
		for(int j = 0; j<=n; j++){
			if(i == j) continue;
			v1.push_back(v[j]);
		}
		int ans = LLONG_MAX;
		do{
			int x = 0;
			for(int j = 0; j<n; j++) x = max(x, max(0ll,v1[j]-b[j]));
			ans = min(ans,x);
		}while(next_permutation(v1.begin(),v1.end()));
		cout<<ans<<" ";
	}
	cout<<endl;

}
# Verdict Execution time Memory Grader output
1 Incorrect 391 ms 412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 391 ms 412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 391 ms 412 KB Output isn't correct
2 Halted 0 ms 0 KB -