You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
503 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int a[N], b[N];
int main() {
int n, m, x;
cin >> n >> m >> x;
//读入a,b两个数组注意它们两个都是升序的
for (int i = 0; i < n; i++)cin >> a[i];
for (int i = 0; i < m; i++)cin >> b[i];
for (int i = 0, j = m - 1;; i++) {
while (j > 0 && a[i] + b[j] > x) j--;
if (a[i] + b[j] == x) {
cout << i << " " << j << endl;
break;
}
}
return 0;
}