| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 2048 MB | 2 | 2 | 2 | 100.000% |
Alice and Bob engage in a strategic duel called Number Magic, where Alice initially chooses a positive integer $N$ called the starting number. The game permits two specific magic operations to be performed on a positive integer $K$:
There are $Q$ rounds of the duel. In round $i,ドル Bob picks a target number $M_i$ and the Alice must determine if it is possible to apply at most 32ドル$ magic operations to the starting number $N$ in order to reach $M_i$. That is, Alice should find a sequence $N_0,N_1,N_2,\dots ,N_k$ with $k≤32$ such that $N_0=N$ and $N_i$ can be obtained by applying a magic operation to $N_{i-1}$ for each 1ドル≤i≤k$? Note, only $M_i$ will change between rounds: $N$ will be the same in each round.
This is a very challenging game, Alice has asked you for help!
The first line of input contains two space integers, $N$ (1ドル≤N≤10^{16}$) and $Q$ (1ドル≤Q≤1000$) where $N$ is the starting number that Alice chooses and $Q$ is the number of rounds.
Then $Q$ lines follow, the $i$’th such line containing a single integer $M_i$ (1ドル≤M_i≤10^{16}$) indicating the target number that Bob chooses for round $i$.
Output $Q$ lines where line $i$ contains the text YES if it is possible to transform $N$ into $M_i$ using at most 32ドル$ applications of magic, otherwise line $i$ contains the text NO.
7 2 43 28
YES YES
74 1 18
YES
22 2 9961 1
NO YES
University > University of Alberta Programming Contest > UAPC 2024 > Division 1 D번