# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
871350 |
2023-11-10T15:56:20 Z |
hvmegy |
Cipele (COCI18_cipele) |
C++17 |
|
37 ms |
4064 KB |
// [ нvмegy ]
// OLPCHUYENTIN2023 GOTOHUE
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define int long long
#define all(c) c.begin(), c.end()
#ifdef hvmegy
#define dbg(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr << "[" << vars << " : ";
string delim = "";
(..., (cerr << delim << values, delim = ", "));
cerr << "]" << '\n';
}
#else
#define dbg(...)
#endif
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
int GOTOHUE();
void init();
int32_t main()
{
cin.tie(0) -> sync_with_stdio(0);
cout << fixed << setprecision(15);
#ifdef hvmegy
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("log.txt", "w", stderr);
#endif
// =============================
bool MULTITEST = 0;
// =============================
init();
int OLPCHUYENTIN2023 = 1;
if (MULTITEST) cin >> OLPCHUYENTIN2023;
for (int i = 1; i <= OLPCHUYENTIN2023; i++) {
if (GOTOHUE()) break;
#ifdef hvmegy
cout << "--ENDTEST--" << '\n';
cerr << "--ENDTEST--" << '\n';
#endif
}
#ifdef hvmegy
cerr << '\n' << clock() * 1000.0 / CLOCKS_PER_SEC << "ms" << '\n';
#endif
return 0;
}
void init() {
}
int GOTOHUE() {
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];
}
sort(1 + all(a));
sort(1 + all(b));
auto ck = [&](int mx) {
int i = 1;
int j = 1;
int cnt = 0;
while (i <= n && j <= m) {
if (abs(a[i] - b[j]) <= mx) {
cnt++;
i++;
j++;
}
else {
a[i] < b[j] ? i++ : j++;
}
}
return cnt >= min(n, m);
};
int lo = -1, hi = INT_MAX;
while (lo + 1 < hi) {
int mi = (lo + hi) >> 1;
if (ck(mi)) hi = mi;
else lo = mi;
}
cout << hi;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
3420 KB |
Output is correct |
2 |
Correct |
31 ms |
3812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
3676 KB |
Output is correct |
2 |
Correct |
37 ms |
4064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
3164 KB |
Output is correct |
2 |
Correct |
19 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
3448 KB |
Output is correct |
2 |
Correct |
14 ms |
2516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
2908 KB |
Output is correct |
2 |
Correct |
26 ms |
3164 KB |
Output is correct |