CF222D.Olympiad
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A boy named Vasya has taken part in an Olympiad. His teacher knows that in total Vasya got at least x points for both tours of the Olympiad. The teacher has the results of the first and the second tour of the Olympiad but the problem is, the results have only points, no names. The teacher has to know Vasya's chances.
Help Vasya's teacher, find two numbers — the best and the worst place Vasya could have won. Note that the total results' table sorts the participants by the sum of points for both tours (the first place has the participant who has got the most points). If two or more participants have got the same number of points, it's up to the jury to assign places to them according to their choice. It is guaranteed that each participant of the Olympiad participated in both tours of the Olympiad.
一名叫瓦西娅的男孩参加了一场奥林匹克竞赛。他的老师知道,瓦西娅在奥林匹克竞赛的两轮比赛中总共至少获得了 x 分。老师手中有第一轮和第二轮比赛的成绩,但问题在于:这些成绩只列出了分数,没有标注姓名。老师需要了解瓦西娅的获奖可能性。
请帮助瓦西娅的老师,找出两个数——瓦西娅可能获得的最好名次和最差名次。注意:最终总成绩表按照两轮得分之和对参赛者进行排序(得分最高者为第一名)。若两名或多名参赛者总分相同,则由评委会根据其判断决定他们的具体名次。题目保证每位奥林匹克竞赛的参赛者都参加了两轮比赛。
输入格式
The first line contains two space-separated integers n, x (1 ≤ n ≤ 105; 0 ≤ x ≤ 2·105) — the number of Olympiad participants and the minimum number of points Vasya earned.
The second line contains n space-separated integers: _a_1, _a_2, ..., a__n (0 ≤ a__i ≤ 105) — the participants' points in the first tour.
The third line contains n space-separated integers: _b_1, _b_2, ..., b__n (0 ≤ b__i ≤ 105) — the participants' points in the second tour.
The participants' points are given in the arbitrary order. It is guaranteed that Vasya was present in the Olympiad — there are two integers i, j (1 ≤ i, j ≤ n) such, that a__i + b__j ≥ x.
第一行包含两个用空格分隔的整数 n 和 x(1≤n≤105;0≤x≤2⋅105)—— 分别表示奥林匹克竞赛参赛者人数以及瓦西娅获得的最低分数。
第二行包含 n 个用空格分隔的整数:a1,a2,…,an(0≤ai≤105)—— 表示各位参赛者在第一轮比赛中的得分。
第三行包含 n 个用空格分隔的整数:b1,b2,…,bn(0≤bi≤105)—— 表示各位参赛者在第二轮比赛中的得分。
参赛者的得分以任意顺序给出。题目保证瓦西娅参加了本次奥林匹克竞赛——即存在两个整数 i,j(1≤i,j≤n),使得 ai+bj≥x。
输出格式
Print two space-separated integers — the best and the worst place Vasya could have got on the Olympiad.
输出两个用空格分隔的整数——Vasya 在奥林匹克竞赛中可能获得的最好名次和最差名次。
输入输出样例
输入#1
5 2 1 1 1 1 1 1 1 1 1 1
输出#1
1 5
输入#2
6 7 4 3 5 6 4 4 8 6 0 4 3 4
输出#2
1 5
说明/提示
In the first text sample all 5 participants earn 2 points each in any case. Depending on the jury's decision, Vasya can get the first (the best) as well as the last (the worst) fifth place.
In the second test sample in the best case scenario Vasya wins again: he can win 12 points and become the absolute winner if the total results' table looks like that — {4:8, 6:4, 3:6, 4:4, 4:3, 5:0}.
In this table all participants are sorted by decreasing points and we can see how much a participant earned in the first and in the second tour.
In the worst case scenario Vasya can get the fifth place if the table looks like that — {4:8, 4:6, 6:4, 5:4, 4:3, 3:0}, and he earned 4 and 3 points in the first and second tours, correspondingly.
在第一个测试样例中,所有 5 名参赛者无论如何都会各得 2 分。根据评委的裁决,瓦夏可能获得第一名(最优名次),也可能获得第五名(最差名次)。
在第二个测试样例中,最优情况下瓦夏再次获胜:若最终总成绩表如下所示 — {4:8, 6:4, 3:6, 4:4, 4:3, 5:0},则他可获得 12 分,成为绝对冠军。
该表中所有参赛者按得分降序排列,其中每对数字表示某位参赛者在第一轮和第二轮中分别获得的分数。
在最差情况下,若成绩表如下所示 — {4:8, 4:6, 6:4, 5:4, 4:3, 3:0},瓦夏将获得第五名;此时他在第一轮和第二轮中分别获得 4 分和 3 分。
输入解题思路,AI测评打分。不知道怎么写?