2645Little L's rank

2645   Little L's rank

题目描述

Little L, with other n people participate in two contests, and some people can get a T-shirt. Little L want to know which is the best rank he may get. You will be given Little L's first contest score.

输入格式:

Input contains multiple test cases. Each test case contains:

The first line contains one integer n .(0<=n<=5000)

Next line contains n integers, which means the scores that n people get in the first contest.

Next line contains n + 1 integers, which means the scores that n + 1 people get in the second contest.

Finally is an integer S, Little L's first contest score.
we have known that if someone's rank is better than Little L's, his second score is not smaller than Little L. And if the sum of someone's two scores is the same as Little L's, he will rank before Little L.

输出格式:

For each group of input,Print a number, which is the best rank that Little L may get.
输入样例 复制
2
3 2
3 2 1
1
输出样例 复制
3

说明

7
27
通过提交
时空限制10000ms/32mb
题目来源数据结构实验与竞赛训练
评测方式在线评测
题目类型
难        度