Submission #675946

#TimeUsernameProblemLanguageResultExecution timeMemory
675946Trisanu_DasCipele (COCI18_cipele)C++17
90 / 90
89 ms3336 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...