Submission #532085

# Submission time Handle Problem Language Result Execution time Memory
532085 2022-03-02T05:23:52 Z chenyan Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 332 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 200010
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb emplace_back
int a[N],b[N];
vector<int>ans;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j;
	cin>>n;
	for(i=0;i<=n;i++) cin>>a[i];
	for(i=0;i<n;i++) cin>>b[i];
	sort(a,a+n+1);
	sort(b,b+n);
	int mx=0;
	for(i=0;i<n;i++) mx=max(mx,a[i]-b[i]);
	ans.pb(mx);
	for(i=n-1;i>=0;i--){
		mx=max(mx,a[i+1]-b[i]);
		ans.pb(mx);
	}
	reverse(all(ans));
	for(int u:ans) cout<<u<<' ';
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:15:10: warning: unused variable 'j' [-Wunused-variable]
   15 |  int n,i,j;
      |          ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -