| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 1024 MB | 314 | 167 | 152 | 55.678% |
Alice, after mastering the sieve of Eratosthenes, excitedly created a puzzle game that made use of it.
The rules of the puzzle game are as follows:
Alice aims to solve the puzzle using the fewest operations, showcasing her puzzle-solving skill. Please help Alice find the minimum number of operations to solve the puzzle.
The first line contains one integer, $N$.
The second line contains space-separated $N$ integers — elements of the array $t$.
Print out the minimum number of operations to solve the puzzle. If the puzzle is unsolvable, print -1.
4 1 1 1 0
2
7 0 1 1 1 0 2 -1
3