Submission #1090922

#TimeUsernameProblemLanguageResultExecution timeMemory
1090922LucaIlieCipele (COCI18_cipele)C++17
0 / 90
71 ms3832 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_N = 3e5; const int MAX_K = 1e9; int f[MAX_N], b[MAX_N]; int main() { int n, m; cin >> n >> m; for ( int i = 0; i < n; i++ ) cin >> f[i]; sort( f, f + n ); for ( int i = 0; i < m; i++ ) cin >> b[i]; sort( b, b + m ); if ( n > m ) { swap( n, m ); swap( f, b ); } int st = -1, dr = MAX_K; while ( dr - st > 1 ) { int k = (st + dr) / 2; int i = 0, j = 0; while ( i < n && j < m ) { if ( f[i] < b[j] ) { if ( b[j] - f[i] <= k ) j++; i++; } else { if ( f[i] - b[j] <= k ) i++; j++; } } if ( i == n ) dr = k; else st = k; } cout << dr << "\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...