| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 41767 | pljplj | 【S】T2 | C++ | 解答错误 | 0 | 643 MS | 4960 KB | 892 | 2026-05-29 19:43:23 |
#include <bits/stdc++.h> using namespace std; using ll = long long; int n; vector<ll> a, b; bool check(ll d) { int j = 0, cnt = 0; for (int i = 0; i < n; i++) { while (j < n && abs(a[i] - b[j]) < d) j++; if (j < n) cnt++, j++; } return cnt == n; } int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { cin >> n; a.resize(n), b.resize(n); for (auto &x : a) cin >> x; for (auto &x : b) cin >> x; sort(a.begin(), a.end()); sort(b.begin(), b.end()); ll l = 0, r = 1e18, ans = 0; while (l <= r) { ll mid = (l + r) >> 1; if (check(mid)) { ans = mid; l = mid + 1; } else r = mid - 1; } cout << ans << '\n'; } return 0; }