# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
855715 |
2023-10-01T17:01:25 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
706 ms |
14000 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 |
686 ms |
9948 KB |
Output is correct |
2 |
Incorrect |
706 ms |
9812 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
701 ms |
9512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
600 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 |
1368 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
26 ms |
1116 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
31 ms |
1104 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
460 ms |
12104 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
603 ms |
14000 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
478 ms |
11340 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |