# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
95404 |
2019-01-31T15:44:50 Z |
dalgerok |
Cipele (COCI18_cipele) |
C++14 |
|
68 ms |
3064 KB |
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, a[N], b[N], c[N];
inline bool check(int x){
for(int i = 1, j = 1; i <= n; i++){
while(j <= m && a[i] - b[j] > x){
j += 1;
}
if(j > m || abs(a[i] - b[j]) > x){
return false;
}
}
return true;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= m; i++){
cin >> b[i];
}
sort(a + 1, a + n + 1);
sort(b + 1, b + m + 1);
if(n > m){
for(int i = 1; i <= n; i++){
c[i] = a[i];
}
for(int i = 1; i <= m; i++){
a[i] = b[i];
}
for(int i = 1; i <= n; i++){
b[i] = c[i];
}
swap(n, m);
}
int l = 0, r = 1e9;
while(r - l > 1){
int mid = (r + l) >> 1;
if(check(mid)){
r = mid;
}
else{
l = mid;
}
}
if(check(l)){
cout << l;
}
else{
cout << r;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
2680 KB |
Output is correct |
2 |
Incorrect |
67 ms |
3064 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
2936 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
3 ms |
504 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Incorrect |
3 ms |
508 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
52 ms |
2540 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
2552 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
51 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |