Submission #779483

# Submission time Handle Problem Language Result Execution time Memory
779483 2023-07-11T13:20:26 Z vjudge1 Cipele (COCI18_cipele) C++17
0 / 90
29 ms 3024 KB
//#include<bits/stdc++.h>
#include<iostream>
#include<bitset>
#include<algorithm>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define pb push_back
#define N 100005
bitset<N>  var;
int main(){
	lalala;
	int n,m;
	vector<int> a,b;cin>>n>>m;
	for(int i=0;i<n;i++){
		int aa;cin>>aa;
		a.pb(aa);
	}
	for(int i=0;i<m;i++){
		int bb;cin>>bb;
		b.pb(bb);
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n>m){
		swap(n,m);swap(a,b);
	}
	int l=0,r=1;//000000000;
	while(l<=r){
		int mid=(l+r)/2;
		int ind=0;
		int check=0;
		//cout<<l<<" "<<r<<endl;
		for(int i=0;i<n;i++){
			int ok=0;
			while(ind<m){
				//cout<<a[i]<<" "<<b[ind]<<" "<<ind<<" "<<i<<endl;
				if(abs(a[i]-b[ind])<=mid){
					ok=1;
					break;
				}
				ind++;
			}
			if(ok==0){
				check=1;
				break;
			}
		}
		if(check)l=mid+1;
		else r=mid-1;
	}
	cout<<l<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 3024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Incorrect 2 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -