Submission #855705

#TimeUsernameProblemLanguageResultExecution timeMemory
855705vjudge1Cipele (COCI18_cipele)C++17
27 / 90
1068 ms5468 KiB
//author: Ahmet Alp Orakci #include <bits/stdc++.h> using namespace std; using i64 = long long; #define int i64 #define ONLINE_JUDGE void solve() { int n, m; cin >> n >> m; vector <int> a(n +1), b(m +1); for(int i = 1; i <= n; i++) cin >> a[i]; for(int j = 1; j <= m; j++) { cin >> b[j]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); if(n < m) { swap(a, b); swap(n, m); } int ans = 1E18; for(int i = 1; i + m -1 <= n; i++) { int mx = 0; for(int j = i; j < i + m; j++) { cerr << "? " << a[j] << " " << b[j - i +1] << "\n"; mx = max(mx, abs(a[j] - b[j - i +1])); } cerr << i << " " << mx << "\n"; ans = min(ans, mx); } cout << ans << "\n"; return; } signed main() { #ifndef ONLINE_JUDGE freopen(".in", "r", stdin); freopen(".out", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; //cin >> t; for(int i = 1; i <= t; i++) { solve(); } 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...