Submission #165491

# Submission time Handle Problem Language Result Execution time Memory
165491 2019-11-27T11:32:03 Z muhi1112 Cipele (COCI18_cipele) C++17
0 / 90
300 ms 1772 KB
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=405;

int n,m,a,ans;
vector<int>l,r;
int main(){
	//fri("in.txt");
	//fro("out.txt");
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a;
		l.pb(a);
	}
	for(int i=0;i<m;i++){
		cin>>a;
		r.pb(a);
	}
	sort(l.begin(),l.end());
	sort(r.begin(),r.end());
	if(n<m){
		reverse(l.begin(),l.end());
		for(int i=0;i<n;i++){
			auto j=lower_bound(r.begin(),r.end(),l[i]);
			if(j==r.end())j--;
			ans=max(ans,abs(*j-l[i]));
			r.erase(j);
		}
	}
	else{
		reverse(r.begin(),r.end());
		for(int i=0;i<m;i++){
			auto j=lower_bound(l.begin(),l.end(),r[i]);
			if(j==l.end())j--;
			ans=max(ans,abs(*j-r[i]));
			l.erase(j);
		}
	}
	cout<<ans<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 133 ms 1600 KB Output is correct
2 Incorrect 168 ms 1772 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 162 ms 1648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Incorrect 12 ms 504 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 300 ms 1528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 286 ms 1648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 273 ms 1520 KB Output isn't correct
2 Halted 0 ms 0 KB -