Submission #880257

# Submission time Handle Problem Language Result Execution time Memory
880257 2023-11-29T04:53:08 Z Mardonbekhazratov A Plus B (IOI23_aplusb) C++17
Compilation error
0 ms 0 KB
int[] smallest_sums(int N,int A[],int B[]){
	sort(A,A+N);
	sort(B,B+N);
	int l=-1,r=1e18;
	while(r-l>1){
		int mid=(l+r)/2;
		int ans=0;
		for(int i=0;i<N;i++){
			ans+=upper_bound(B,B+N,mid-A[i])-B;
		}
		if(ans>=N) r=mid;
		else l=mid;
	}
	int ans[N];
	int j=0;
	for(int i=0;i<N;i++){
		int pos=lower_bound(B,B+N,r-A[i])-B;
		for(int k=0;k<pos;k++){
			ans[j++]=A[i]+B[k];
		}
	}
	while(j<N) ans[j++]=r;
	sort(ans,ans+N);
	return ans;
}

Compilation message

aplusb.cpp:2:4: error: structured binding declaration cannot have type 'int'
    2 | int[] smallest_sums(int N,int A[],int B[]){
      |    ^~
aplusb.cpp:2:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
aplusb.cpp:2:4: error: empty structured binding declaration
aplusb.cpp:2:7: error: expected initializer before 'smallest_sums'
    2 | int[] smallest_sums(int N,int A[],int B[]){
      |       ^~~~~~~~~~~~~