双指针(对撞指针)模版题
#include <iostream>
using namespace std;
int main(void) {
int n, m, x;
cin >> n >> m >> x;
int a[n], b[m];
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < m; ++i) cin >> b[i];
int i = 0, j = m - 1;
while (i < n && j >= 0) {
int s = a[i] + b[j];
if (s == x) return printf("%d %d\n", i, j), 0;
if (s < x) ++i;
else --j;
}
return 0;
}