// __ __ __ _ __ _____
// / //_/__ _____/ /_(_) /__ / ___/__ ________ _
// / ,< / _ `/ __/ __/ / '_/ / (_ / _ `/ __/ _ `/
// /_/|_||_,_/_/ |__/_/_/|_| |___/|_,_/_/ |_, /
// /___/
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define vi vector<int>
#define MOD 1000000007
#define iter(a) for(auto &u : a)
#define f(i, a, b) for(int i = a; i < b; i++)
#define pii pair<int, int>
#define pb push_back
#define all(a) a.begin(), a.end()
void solution() {
int n, s, k;
cin >> n >> s >> k;
vector<int> d(n), v(n+1), x(n+1), sum(n+1);
f(i, 1, n) {
cin >> d[i];
}
f(i, 1, n+1) {
cin >> v[i];
}
x[1] = 0;
f(i, 2, n+1) {
x[i] = x[i - 1] + d[i - 1];
}
int res = 0, best = 0;
sum[0] = 0;
f(i, 1, n+1) {
sum[i] = v[i] + sum[i - 1];
}
f(i, 1, n+1) {
int r = upper_bound(x.begin() + 1, x.begin() + n + 1, x[i] + k) - x.begin() - 1;
int l = lower_bound(x.begin() + 1, x.begin() + n + 1, x[i] - k) - x.begin() - 1;
if (sum[r] - sum[l] > res) {
res = sum[r] - sum[l];
best = i;
}
}
cout << 1 << "\n" << best << "\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solution();
}
return 0;
}
/*
____ _ ___ ____ _
| __ )(_) __ _ / _ | / ___| |__ __ _ _ __ ___ _ __
| _ || |/ _` | | | | | | '_ | / _` | '_ ` _ || '_ |
| |_) | | (_| | |_| | |___| | | | (_| | | | | | | |_)|
|____/|_||__, ||___/ |___|_| |_||__,_|_| |_| |_| .__/
|___/ |_|
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |