No.1955 Not Prime
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もしくは右上の雲マークをクリックしてアカウントを作成してください。
H20
蜜蜂
platinum