# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1090923 |
2024-09-19T07:33:59 Z |
LucaIlie |
Cipele (COCI18_cipele) |
C++17 |
|
66 ms |
4180 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5;
const int MAX_K = 1e9;
int f[MAX_N], b[MAX_N];
int main() {
int n, m;
cin >> n >> m;
for ( int i = 0; i < n; i++ )
cin >> f[i];
sort( f, f + n );
for ( int i = 0; i < m; i++ )
cin >> b[i];
sort( b, b + m );
if ( n > m ) {
swap( n, m );
swap( f, b );
}
int st = -1, dr = MAX_K;
while ( dr - st > 1 ) {
int k = (st + dr) / 2;
int j = 0;
for ( int i = 0; i < n; i++ ) {
while ( j < m && abs( f[i] - b[j] ) > k )
j++;
j++;
}
if ( j <= m )
dr = k;
else
st = k;
}
cout << dr << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
2640 KB |
Output is correct |
2 |
Correct |
65 ms |
3000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
2900 KB |
Output is correct |
2 |
Correct |
66 ms |
2912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
356 KB |
Output is correct |
2 |
Correct |
4 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
356 KB |
Output is correct |
2 |
Correct |
4 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
356 KB |
Output is correct |
2 |
Correct |
3 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
356 KB |
Output is correct |
2 |
Correct |
4 ms |
612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
356 KB |
Output is correct |
2 |
Correct |
4 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
2392 KB |
Output is correct |
2 |
Correct |
39 ms |
3792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
2652 KB |
Output is correct |
2 |
Correct |
38 ms |
3672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
2392 KB |
Output is correct |
2 |
Correct |
56 ms |
4180 KB |
Output is correct |