問題一覧 > 通常問題

No.1955 Not Prime

レベル : / AI推定難易度 : 1700 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 58
作問者 : H20 / テスター : 蜜蜂 platinum
お気に入りにしたユーザー ProblemId : 7888 / 自分の提出
問題文最終更新日: 2022-05-19 20:36:54
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 344 (順位表) の他の問題:

Problem Statement

You are given $N$ pairs of $2$ positive integers $(A_1, B_1), (A_2, B_2), \ldots, (A_N, B_N)$.

For each pair, assign one of its values to a set $S$ and the other value to a set $T$.

Is it possible to make the assignment as follows?

Take arbitrary values from $S$ and $T$, and let $s$ be the value taken from $S$ and $t$ be the value taken from $T$.

Regard $s$ and $t$ as strings with no leading $0$. For any $s, t$, the value obtained by interpreting the string formed by concatenating them in this order as a base-$10$ number is not prime.

Input

$N$
$A_1$ $B_1$
$A_2$ $B_2$
$\vdots$
$A_N$ $B_N$

Constraints

  • $1 \le N \le 500$
  • $1 \le A_i, B_i \lt 1000$
  • All inputs are integers

Output

Print Yes if the values can be assigned so as to satisfy the condition, and No otherwise.

Print a newline at the end.

Sample

Sample 1
Input
7
213 13
35 92
35 55
71 425
134 51
72 230
4 21
Output
Yes

For example, the following assignment is possible.

$S = \{13,35,35,71,51,72,21\}$

$T = \{213,92,55,425,134,230,4\}$

Sample 2
Input
4
999 100
999 999
100 100
100 100
Output
No

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