Submission #464707

#TimeUsernameProblemLanguageResultExecution timeMemory
464707Hamed5001Cipele (COCI18_cipele)C++14
27 / 90
1077 ms1220 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; /* dp[i] = min ugliness if I paired first i shoes dp[i] = */ void solve() { int N, M; cin >> N >> M; vector<int> A1(N), A2(M); for (auto& a : A1) cin >> a; for (auto& a : A2) cin >> a; sort(A1.begin(), A1.end()); sort(A2.begin(), A2.end()); if (N > M) { swap(N, M); swap(A1, A2); } int ans = INT_MAX; for (int i = 0; i+N-1 < M; i++) { int tmp = 0; for (int j = 0; j < N; j++) { tmp = max(tmp, abs(A1[j] - A2[i+j])); } ans = min(ans, tmp); } cout << ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); solve(); }
#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...