#include #include #include using namespace std; int main() { int N; cin >> N; vector A(N + 1), B(N + 1), D(N); for (int i = 0; i <= N; ++i) cin >> A[i]; for (int i = 0; i <= N; ++i) cin >> B[i]; for (int i = 0; i < N; ++i) cin >> D[i]; vector > dp(N + 1, vector(N + 1, false)); dp[0][0] = true; int ans = 0; for (int i = 0; i <= N; ++i) { for (int j = (i == 0 ? 1 : 0); i + j <= N; ++j) { if (A[i] + B[j] >= D[i + j - 1] && ((i >= 1 && dp[i - 1][j]) || (j >= 1 && dp[i][j - 1]))) { dp[i][j] = true; ans = max(ans, i + j); } } } cout << ans << endl; return 0; }