# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
855706 |
2023-10-01T16:44:45 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
1000 ms |
2040 KB |
//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 time |
Memory |
Grader output |
1 |
Correct |
16 ms |
1880 KB |
Output is correct |
2 |
Correct |
28 ms |
1884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1884 KB |
Output is correct |
2 |
Correct |
27 ms |
2040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1042 ms |
1628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
717 ms |
1876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1045 ms |
1628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |