CF1313B.Different Rules
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be n participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the largest number of problems wins, the organizers came up with different rules.
Suppose in the first round participant A took x-th place and in the second round — y-th place. Then the total score of the participant A is sum x+y. The overall place of the participant A is the number of participants (including A) having their total score less than or equal to the total score of A. Note, that some participants may end up having a common overall place. It is also important to note, that in both the first and the second round there were no two participants tying at a common place. In other words, for every i from 1 to n exactly one participant took i-th place in first round and exactly one participant took i-th place in second round.
Right after the end of the Olympiad, Nikolay was informed that he got x-th place in first round and y-th place in the second round. Nikolay doesn't know the results of other participants, yet he wonders what is the minimum and maximum place he can take, if we consider the most favorable and unfavorable outcome for him. Please help Nikolay to find the answer to this question.
尼古拉最近才刚开始参加编程竞赛,但已经成功晋级一场著名奥林匹克竞赛的决赛。决赛共有 n 名参赛者,其中一人就是尼古拉。和任何优秀的奥林匹克竞赛一样,比赛分为两轮。主办方厌倦了传统的“解题数量最多者获胜”的规则,于是制定了全新的计分规则。
假设某位参赛者 A 在第一轮中获得第 x 名,在第二轮中获得第 y 名,则该参赛者 A 的总得分为 x+y。参赛者 A 的最终名次定义为:总得分小于或等于 A 的总得分的参赛者人数(包括 A 自身)。注意,若干参赛者可能并列同一最终名次。还需特别注意:在第一轮和第二轮中,均不存在两名参赛者并列同一排名的情况。换言之,对每个从 1 到 n 的整数 i,恰好有一名参赛者在第一轮中获得第 i 名,也恰好有一名参赛者在第二轮中获得第 i 名。
奥林匹克竞赛刚一结束,尼古拉便得知自己在第一轮中获得第 x 名,在第二轮中获得第 y 名。尼古拉尚不清楚其他参赛者的成绩,但他很好奇:若考虑对他最有利和最不利的情形,他可能取得的最小和最大最终名次分别是多少?请帮助尼古拉解答这一问题。
输入格式
The first line contains an integer t (1≤t≤100) — the number of test cases to solve.
Each of the following t lines contains integers n, x, y (1≤n≤109, 1≤x,y≤n) — the number of participants in the olympiad, the place that Nikolay took in the first round and the place that Nikolay took in the second round.
第一行包含一个整数 t(1≤t≤100)—— 表示待解决的测试用例数量。
接下来的 t 行中,每行包含三个整数 n、x、y(1≤n≤109,1≤x,y≤n)—— 分别表示奥林匹克竞赛的参赛人数、尼古拉在第一轮中的名次以及尼古拉在第二轮中的名次。
输出格式
Print two integers — the minimum and maximum possible overall place Nikolay could take.
输出两个整数——尼古拉可能获得的最低和最高总排名。
输入输出样例
输入#1
1 5 1 3
输出#1
1 3
输入#2
1 6 3 4
输出#2
2 6
说明/提示
Explanation for the first example:
Suppose there were 5 participants A-E. Let's denote Nikolay as A. The the most favorable results for Nikolay could look as follows:

However, the results of the Olympiad could also look like this:

In the first case Nikolay would have taken first place, and in the second — third place.
第一个样例的解释:
假设共有 5 名参赛者 A–E。我们用 A 表示尼古拉。那么对尼古拉最有利的比赛结果可能如下所示:

然而,本次奥林匹克竞赛的实际结果也可能是这样的:

在第一种情况下,尼古拉将获得第一名;而在第二种情况下,他将获得第三名。
输入解题思路,AI测评打分。不知道怎么写?