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.
24 lines
520 B
24 lines
520 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 1e5 + 10;
|
|
typedef long long LL;
|
|
LL a[N], b[N], s[N];
|
|
LL n, m;
|
|
LL cnt;
|
|
int main() {
|
|
freopen("city.in", "r", stdin);
|
|
freopen("city.out", "w", stdout);
|
|
cin >> n >> m;
|
|
for (int i = 1; i <= n; i++) cin >> a[i];
|
|
for (int i = 1; i <= n; i++) cin >> b[i];
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
cnt += a[i];
|
|
if (cnt >= m) {
|
|
cout << b[i] << endl;
|
|
return 0;
|
|
}
|
|
}
|
|
return 0;
|
|
} |