用的二分,好像也可以哎
`
using namespace std;
const int N = 100002;
int main() {
int m, n, c;
int arr1[N] = { 0 };
int arr2[N] = { 0 };
cin >> m >> n >> c;
for (int i = 0; i < m; i++) {
cin >> arr1[i];
}
for (int i = 0; i < n; i++) {
cin >> arr2[i];
}
int i = 0;
while (i < m && arr1[i] < c) {
int l = 0, r = n - 1;
int target = c - arr1[i];
while (l <= r) {
int mid = l + r >> 1; //l mid r ;
if (arr2[mid] > target) r = mid - 1;
if (arr2[mid] < target) l = mid + 1;
if (arr2[mid] == target) {
cout << i << " " << mid << endl;
break;
}
}
i++;
}
return 0;
}`