CF1535A.Fair Playoff

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the tournament.

It is known that in a match between two players, the one whose skill is greater will win. The skill of the ii-th player is equal to sis_i and all skill levels are pairwise different (i. e. there are no two identical values in the array ss).

The tournament is called fair if the two players with the highest skills meet in the finals.

Determine whether the given tournament is fair.

四名选手参加季后赛锦标赛。锦标赛按照以下赛制进行:第一名选手与第二名选手对战,第三名选手与第四名选手对战,然后两场比赛的胜者再进行决赛。

已知:在两名选手之间的比赛中,技能值较高者获胜。第 ii 名选手的技能值为 sis_i,且所有技能值两两不同(即数组 ss 中不存在两个相等的值)。

若技能值最高的两名选手在决赛中相遇,则称该锦标赛是公平的。

请判断给定的锦标赛是否公平。

输入格式

The first line contains a single integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases.

A single line of test case contains four integers s1,s2,s3,s4s_1, s_2, s_3, s_4 (1≤si≤1001 \le s_i \le 100) — skill of the players. It is guaranteed that all the numbers in the array are different.

第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4)—— 测试用例的数量。

每个测试用例占一行,包含四个整数 s1,s2,s3,s4s_1, s_2, s_3, s_4(1≤si≤1001 \le s_i \le 100)—— 各玩家的技能值。保证数组中所有数字互不相同。

输出格式

For each testcase, output YES if the tournament is fair, or NO otherwise.

对于每个测试用例,如果锦标赛是公平的,则输出 YES;否则输出 NO。

输入输出样例

  • 输入#1

    4
    3 7 9 5
    4 5 6 9
    5 3 8 1
    6 5 3 2

    输出#1

    YES
    NO
    YES
    NO

说明/提示

Consider the example:

  1. in the first test case, players 22 and 33 with skills 77 and 99 advance to the finals;
  2. in the second test case, players 22 and 44 with skills 55 and 99 advance to the finals. The player with skill 66 does not advance, but the player with skill 55 advances to the finals, so the tournament is not fair;
  3. in the third test case, players 11 and 33 with skills 55 and 88 advance to the finals;
  4. in the fourth test case, players 11 and 33 with skills 66 and 33 advance to the finals. The player with skill 55 does not advance, but the player with skill 33 advances to the finals, so the tournament is not fair.

考虑以下示例:

  1. 在第一个测试用例中,技能值为 77 和 99 的选手 22 与 33 晋级决赛;
  2. 在第二个测试用例中,技能值为 55 和 99 的选手 22 与 44 晋级决赛。技能值为 66 的选手未能晋级,但技能值为 55 的选手却晋级了决赛,因此该锦标赛不公平;
  3. 在第三个测试用例中,技能值为 55 和 88 的选手 11 与 33 晋级决赛;
  4. 在第四个测试用例中,技能值为 66 和 33 的选手 11 与 33 晋级决赛。技能值为 55 的选手未能晋级,但技能值为 33 的选手却晋级了决赛,因此该锦标赛不公平。

输入解题思路,AI测评打分。不知道怎么写?

首页