Problem H
Prove You Are a Robot
The rebels have nearly accessed a datacenter with a lot of the AI Overlords’ plans stored on it. If we can get access to this data, we’ll be able to thwart their every move! However, there’s one last layer of security; a reverse CAPTCHA where you have to prove you’re a robot by highlighting the prime numbers in a grid of integers.
Prime numbers are positive integers strictly greater than $1$ whose only divisors are $1$ and themselves. For instance, $7$ is prime, because the only positive integers that divide it are $1$ and $7$. However, $51$ is not prime, since it is divisible by $3$.
Input
The first line of input contains two space-separated integers, $n$ and $m$ $(1 \leq n, m \leq 10)$, indicating the size of the grid. The next $n$ lines will each consist of $m$ space-separated integers, each between $1$ and $10^{9}$, indicating the $n \times m$ grid.
Output
Output an $n \times m$ string with no spaces within each line, where the character $1$ represents a prime in that position and the character $0$ represents a non-prime.
Explanation of sample 1
The first line of input in the first sample tells us that we will be examining a $2 \times 2$ grid. The next two lines give us our numbers to examine: $10, 23, 19$, and $8$. Since $10$ and $8$ are composite, while $23$ and $19$ are prime, this means that our output should be the two lines $01$ and $10$.
| Sample Input 1 | Sample Output 1 |
|---|---|
2 2 10 23 19 8 |
01 10 |
| Sample Input 2 | Sample Output 2 |
|---|---|
1 2 93328889 741636463 |
10 |