Submission #158779

# Submission time Handle Problem Language Result Execution time Memory
158779 2019-10-18T18:19:41 Z a_player Cipele (COCI18_cipele) C++14
90 / 90
163 ms 1912 KB
#include <bits/stdc++.h>

using namespace std;

int N,M;
int r[200001];
int l[200001];
bool check(int T){
  int a=0;
  for(int i=0;i<N;i++){
    while(abs(l[a]-r[i])>T&&a<M)a++;
    if(a==M)return false;
    a++;
  }
  return true;
}
int main() {
  cin>>N>>M;
  for(int i=0;i<N;i++)cin>>r[i];
  for(int i=0;i<M;i++)cin>>l[i];
  if(N>M){
    swap(N,M);
    swap(r,l);
  }
  sort(r,r+N);
  sort(l,l+M);
  int x=-1;
  for(int b=1e9+1;b>=1;b/=2)
  while(!check(x+b))x+=b;
  cout<<x+1;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 133 ms 1148 KB Output is correct
2 Correct 163 ms 1068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 1244 KB Output is correct
2 Correct 162 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 380 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 396 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 992 KB Output is correct
2 Correct 97 ms 1852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 151 ms 1052 KB Output is correct
2 Correct 101 ms 1892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 1016 KB Output is correct
2 Correct 139 ms 1912 KB Output is correct