Submission #675946

# Submission time Handle Problem Language Result Execution time Memory
675946 2022-12-28T13:45:27 Z Trisanu_Das Cipele (COCI18_cipele) C++17
90 / 90
89 ms 3336 KB
#include <bits/stdc++.h>
using namespace std;
 
int N,M;
int r[200001], 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 ans = -1;
  for(int b = 1e9 + 1; b >= 1; b /= 2) while(!check(ans + b)) ans += b;
  cout << ans + 1 << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 74 ms 2508 KB Output is correct
2 Correct 89 ms 2876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 2880 KB Output is correct
2 Correct 85 ms 2800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 320 KB Output is correct
2 Correct 5 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 5 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 7 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 324 KB Output is correct
2 Correct 5 ms 360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2372 KB Output is correct
2 Correct 52 ms 2876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 2592 KB Output is correct
2 Correct 50 ms 2884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 2300 KB Output is correct
2 Correct 74 ms 3336 KB Output is correct