Submission #779507

# Submission time Handle Problem Language Result Execution time Memory
779507 2023-07-11T13:33:29 Z DangerNoodle7591 Cipele (COCI18_cipele) C++17
90 / 90
44 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=1000000000;
	while(l<=r){
		int mid=(l+r)/2;
		int ok=0;
		for(int i=0;i<m;i++){
			if(ok==n){
				break;
			}
			if(abs(b[i]-a[ok])<=mid){
				ok++;
			}
		}
		if(ok==n){
			r=mid-1;
		}
		else l=mid+1;
	}
	cout<<l<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 33 ms 2156 KB Output is correct
2 Correct 43 ms 2144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 2236 KB Output is correct
2 Correct 42 ms 3024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1916 KB Output is correct
2 Correct 24 ms 1960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 2096 KB Output is correct
2 Correct 20 ms 2264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1884 KB Output is correct
2 Correct 36 ms 2940 KB Output is correct