#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1e18
vector<int> a;
vector<int> b;
int memo[5009][5009];
/*
int dp(int l, int r, int left){
if(l == -1 || r == -1){
if(left) return INF/2;
else return 0;
}
if(memo[l][r][left] != -1) return memo[l][r][left];
int ans = -INF;
return memo[l][r][left] =
}
*/
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
a.resize(n);
b.resize(m);
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < m; i++){
cin >> b[i];
}
//if(n <= 5000 && m <= 5000){
//}
// else{
sort(a.begin(), a.end());
sort(b.begin(), b.end());
int maxi = -INF;
for(int i = 0; i < m; i++){
maxi = max(maxi, abs(a[i]-b[i]));
}
cout << maxi << endl;
// }
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
2048 KB |
Output is correct |
2 |
Correct |
45 ms |
2048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
2048 KB |
Output is correct |
2 |
Correct |
47 ms |
2048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
564 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
41 ms |
3188 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
63 ms |
3420 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
44 ms |
3172 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |