记录编号 |
250649 |
评测结果 |
AATTTTTTTT |
题目名称 |
烤鸡翅 |
最终得分 |
20 |
用户昵称 |
TZJerry |
是否通过 |
未通过 |
代码语言 |
C++ |
运行时间 |
8.001 s |
提交时间 |
2016-04-15 16:47:42 |
内存使用 |
4.13 MiB |
显示代码纯文本
#include<cstring>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<queue>
#include<cstdio>
#include<iostream>
#define ll long long
#define maxn 250001
int f[maxn], x[maxn], y[maxn], e[maxn], n, ans;
using namespace std;
void work(int q,int w,int e)
{
if (q == n)
{
ans = max(ans, w);
return;
}
if (x[q+1] + e >= y[q+1])
{
work(q + 1, w + 1, x[q+1] + e - y[q+1]);
work(q + 1, w, x[q+1] + e);
}
else
{
work(q + 1, w, x[q+1] + e);
}
}
int main()
{
freopen("wing.in", "r", stdin);
freopen("wing.out", "w", stdout);
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
for (int i = 1; i <= n; i++) scanf("%d", &y[i]);
work(0,0,0);
printf("%d\n", ans);
return 0;
}