Submission #532095

# Submission time Handle Problem Language Result Execution time Memory
532095 2022-03-02T05:41:04 Z chenyan Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
0 ms 204 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(i=0;i<ans.size();i++){
		if(i) cout<<' ';
		cout<<ans[i];
	}
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:29:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(i=0;i<ans.size();i++){
      |          ~^~~~~~~~~~~
ho_t1.cpp:15:10: warning: unused variable 'j' [-Wunused-variable]
   15 |  int n,i,j;
      |          ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -