| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1309429 | ayuxhkumxr22 | Cipele (COCI18_cipele) | C++20 | 0 ms | 0 KiB |
bool check(long long x, int n, int m, vector<int>& A, vector<int>& B) {
// Ensure A is the smaller array to simplify logic
// We must match all elements of the smaller array
if (n > m) return check(x, m, n, B, A);
int j = 0; // Pointer for larger array B
for (int i = 0; i < n; i++) {
// Skip elements in B that are too small for A[i]
while (j < m && B[j] < A[i] - x) {
j++;
}
// If we ran out of elements in B, we can't match A[i]
if (j == m) return false;
// If B[j] is too big, it's impossible to match A[i]
if (B[j] > A[i] + x) return false;
// Match found! Move to next pair
j++;
}
return true;
}
void solve() {
// 1. Input and Sort
// 2. Binary Search 0 to 1e9
// 3. Print ans
}
