# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
81863 |
2018-10-27T12:10:21 Z |
Shtef |
Cipele (COCI18_cipele) |
C++14 |
|
61 ms |
10976 KB |
#include <iostream>
#include <algorithm>
using namespace std;
int n, m, a[100005], b[100005];
bool distval(int d){
int j = 0;
for(int i = 0; i < n ; ++i){
while(j < m && b[j] < a[i] - d){
j++;
}
if(j == m)
return 0;
if(b[j] > a[i] + d)
return 0;
j++;
}
return 1;
}
void solve(){
int l = 0, h = 1e9;
while(l < h){
int mid = (l + h) / 2;
if(distval(mid)){
h = mid;
}
else{
l = mid + 1;
}
}
cout << l << endl;
}
int main ()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
for(int i = 0 ; i < n ; ++i){
cin >> a[i];
}
sort(a, a + n);
for(int i = 0 ; i < m ; ++i){
cin >> b[i];
}
sort(b, b + m);
if(n > m){
swap(n, m);
swap(a, b);
}
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
2680 KB |
Output is correct |
2 |
Correct |
54 ms |
4668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
6352 KB |
Output is correct |
2 |
Correct |
61 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8008 KB |
Output is correct |
2 |
Correct |
4 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8008 KB |
Output is correct |
2 |
Correct |
5 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8008 KB |
Output is correct |
2 |
Correct |
4 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8008 KB |
Output is correct |
2 |
Correct |
4 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8008 KB |
Output is correct |
2 |
Correct |
4 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
8008 KB |
Output is correct |
2 |
Correct |
32 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
8008 KB |
Output is correct |
2 |
Correct |
26 ms |
8008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
9288 KB |
Output is correct |
2 |
Correct |
43 ms |
10976 KB |
Output is correct |