# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
855711 |
2023-10-01T16:50:04 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
727 ms |
13652 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 i = 1; i <= m; i++) {
cin >> b[i];
}
if(n < m) {
swap(a, b);
swap(n, m);
}
multiset <i64> ms(b.begin() +1, b.end());
ms.emplace(-1E18);
ms.emplace(1E18);
sort(a.begin(), a.end());
int ans = 0;
for(int i = 1; i <= n; i++) {
auto it = prev(ms.lower_bound(a[i]));
auto it2 = next(it);
cerr << a[i] << " :: " << *it << " " << *it2 << "\n";
if(a[i] - *it < *it2 - a[i]) {
ans = max(ans, a[i] - *it);
ms.erase(it);
} else {
ans = max(ans, *it2 - a[i]);
ms.erase(it2);
}
}
cout << ans;
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 |
692 ms |
9884 KB |
Output is correct |
2 |
Incorrect |
694 ms |
9812 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
727 ms |
9404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
25 ms |
1116 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
25 ms |
1052 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
32 ms |
1256 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
472 ms |
12280 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
590 ms |
13652 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
479 ms |
11576 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |