Submission #888832

#TimeUsernameProblemLanguageResultExecution timeMemory
888832dimashhhCipele (COCI18_cipele)C++17
90 / 90
34 ms4484 KiB
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 1, MOD = 1e9 + 9; typedef long long ll; int n,m,a[N],b[N]; bool f(int mid){ int it = 1; for(int i = 1;i <= n;i++){ while(it <= m && abs(b[it] - a[i]) > mid) it++; if(it > m) return false; it++; } return 1; } void test(){ cin >> n >> m; for(int i = 1;i <= n;i++){ cin >> a[i]; } for(int i = 1;i <= m;i++){ cin >> b[i]; } if(n > m){ for(int i = 1;i <= n;i++){ swap(a[i],b[i]); } swap(n,m); } sort(a + 1,a + n + 1); sort(b + 1,b + m + 1); ll l = -1,r = 2e9; while(r - l > 1){ ll mid = (l + r) >> 1; if(f(mid)){ r = mid; }else{ l = mid; } } cout << r; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int T = 1;//cin >> T; while (T--) test(); }
#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...