for (int i = 0; i < n; i ++) cin >> a[i]; for (int i = 0; i < m; i ++) cin >> b[i];
for (int i = 0; i < n; i ++) { int l = 0, r = m - 1; while (l < r) { int mid = l + r + 1 >> 1; if (a[i] + b[mid] <= x) l = mid; else r = mid - 1; } if (a[i] + b[l] == x) { cout << i << ' ' << l << '\n'; break; } }
for (int i = 0; i < n; i ++ ) cin >> a[i]; for (int i = 0; i < m; i ++ ) cin >> b[i];
// min a, max b, a + b = x, a+ -> b- for (int i = 0, j = m - 1; i < n; i ++ ) { int l = 0, r = j; while (l < r) { int mid = l + r + 1 >> 1; if (a[i] + b[mid] <= x) l = mid; else r = mid - 1; } j = l; if (a[i] + b[j] == x) { cout << i << ' ' << j << '\n'; break; } }
for (int i = 0; i < n; i ++ ) cin >> a[i]; for (int i = 0; i < m; i ++ ) cin >> b[i];
// min a, max b, a + b = x, a+ -> b- for (int i = 0, j = m - 1; i < n;) { int l = 0, r = j; while (l < r) { int mid = l + r + 1 >> 1; if (a[i] + b[mid] <= x) l = mid; else r = mid - 1; } j = l; if (a[i] + b[j] == x) { cout << i << ' ' << j << '\n'; break; }
l = i, r = n - 1; while (l < r) { int mid = l + r >> 1; if (a[mid] + b[j] >= x) r = mid; else l = mid + 1; } i = l; if (a[i] + b[j] == x) { cout << i << ' ' << j << '\n'; break; } }