問題一覧 > 通常問題

No.1366 Swap Kadomatsu Sequence: Ume

レベル : / AI推定難易度 : 151 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 128 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 264
作問者 : mai / テスター : face4
お気に入りにしたユーザー ProblemId : 3415 / 自分の提出
問題文最終更新日: 2021-01-29 21:32:16
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 280 (門松コンテスト) (順位表) の他の問題:

Definition

When a sequence $v = (a_1,a_2,a_3)$ consisting of three elements satisfies the following conditions, $v$ is said, according to tradition, to be a Kadomatsu sequence.

  1. $a_1,a_2,a_3$ are all distinct
  2. Among the three elements, $a_2$ is the largest or the smallest

Problem Statement

You are given two sequences, each consisting of three elements.
Perform the following operation exactly once. Not performing the operation at all is not allowed.

  • Choose one element from one sequence and one element from the other sequence, and swap those elements.
    You may choose the same number.

Can both sequences be made Kadomatsu sequences after the operation?
Print Yes if it is possible, and No otherwise.

Input

$a_1\ a_2\ a_3$
$b_1\ b_2\ b_3$

$1 \le a_i, b_i \le 9$
All values in the input are integers.

Output

Print Yes if both sequences can be made Kadomatsu sequences, and No if this is impossible.

Sample

Sample 1
Input
4 5 6
1 2 3
Output
Yes

For example, swap 5 and 2. Then the first sequence becomes 4 2 6 and the second sequence becomes 1 5 3, and both of them are Kadomatsu sequences.

Sample 2
Input
3 4 5
3 5 4
Output
No

You cannot swap within the same sequence.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。