Files
python/TangDou/AcWing/DoublePointer/800.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

22 lines
524 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}