Submission #1132400

#TimeUsernameProblemLanguageResultExecution timeMemory
1132400Le_Minh_DucCipele (COCI18_cipele)C++20
90 / 90
66 ms1192 KiB
#include<bits/stdc++.h> #define ll long long #define lll __int128_t #define f first #define s second using namespace std; const int mod = 1e9 + 7; const int N = 1e5 + 5; const ll INF = 1e18 + 7; int n, m; vector<int> a(N), b(N); bool check(int val){ int p = 1; for(int i = 1; i <= n; i++){ int l = a[i] - val, r = a[i] + val; while(p <= m && (b[p] < l || b[p] > r)) p++; p++; } return p <= m + 1; } signed main(){ // freopen(".inp", "r", stdin); // // freopen(".out", "w", stdout); // 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]; if(n > m){ swap(n, m); swap(a, b); } sort(a.begin() + 1, a.begin() + n + 1); sort(b.begin() + 1, b.begin() + m + 1); int l = 0, r = 1e9, mid; while(l <= r){ int mid = (l + r) >> 1; // cout<<l<<" "<<r<<" "<<mid<<'\n'; if(check(mid)) r = mid - 1; else l = mid + 1; } cout<<l; }
#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...