codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1266B.md (2017B)


      1 Source: https://codeforces.com/problemset/problem/1266/B
      2 
      3 B. Dice Tower
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Bob is playing with $6$-sided dice. A net of such standard cube is shown below.
     22 
     23 ![](https://espresso.codeforces.com/0065ec3465bffc3d36eefbdb4a5cab1e2598146d.png)
     24 
     25 He has an unlimited supply of these dice and wants to build a tower by stacking multiple dice on top of each other, while choosing the orientation of each dice. Then he counts the number of visible pips on the faces of the dice.
     26 
     27 For example, the number of visible pips on the tower below is $29$ — the number visible on the top is $1$, from the south $5$ and $3$, from the west $4$ and $2$, from the north $2$ and $4$ and from the east $3$ and $5$.
     28 
     29 ![](https://espresso.codeforces.com/8b7b0bd353a0dc7abd2f410cbb90999b99b2a2a7.png)
     30 
     31 The one at the bottom and the two sixes by which the dice are touching are not visible, so they are not counted towards total.
     32 
     33 Bob also has $t$ favourite integers $x_i$, and for every such integer his goal is to build such a tower that the number of visible pips is exactly $x_i$. For each of Bob's favourite integers determine whether it is possible to build a tower that has exactly that many visible pips.
     34 
     35 Input
     36 
     37 The first line contains a single integer $t$ ($1 \leq t \leq 1000$) — the number of favourite integers of Bob.
     38 
     39 The second line contains $t$ space-separated integers $x_i$ ($1 \leq x_i \leq 10^{18}$) — Bob's favourite integers.
     40 
     41 Output
     42 
     43 For each of Bob's favourite integers, output "YES" if it is possible to build the tower, or "NO" otherwise (quotes for clarity).
     44 
     45 Example
     46 
     47 Input
     48 
     49 ```
     50 4
     51 29 34 19 38
     52 ```
     53 
     54 Output
     55 
     56 ```
     57 YES
     58 YES
     59 YES
     60 NO
     61 ```
     62 
     63 Note
     64 
     65 The first example is mentioned in the problem statement.
     66 
     67 In the second example, one can build the tower by flipping the top dice from the previous tower.
     68 
     69 In the third example, one can use a single die that has $5$ on top.
     70 
     71 The fourth example is impossible.