1451D.md (1640B)
1 Source: https://codeforces.com/problemset/problem/1451/D 2 3 D. Circle Game 4 5 time limit per test 6 7 2 seconds 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 Utkarsh is forced to play yet another one of Ashish's games. The game progresses turn by turn and as usual, Ashish moves first. 22 23 Consider the 2D plane. There is a token which is initially at $(0,0)$. In one move a player must increase either the $x$ coordinate or the $y$ coordinate of the token by exactly $k$. In doing so, the player must ensure that the token stays within a (Euclidean) distance $d$ from $(0,0)$. 24 25 In other words, if after a move the coordinates of the token are $(p,q)$, then $p^2 + q^2 \leq d^2$ must hold. 26 27 The game ends when a player is unable to make a move. It can be shown that the game will end in a finite number of moves. If both players play optimally, determine who will win. 28 29 Input 30 31 The first line contains a single integer $t$ ($1 \leq t \leq 100$) — the number of test cases. 32 33 The only line of each test case contains two space separated integers $d$ ($1 \leq d \leq 10^5$) and $k$ ($1 \leq k \leq d$). 34 35 Output 36 37 For each test case, if Ashish wins the game, print "Ashish", otherwise print "Utkarsh" (without the quotes). 38 39 Example 40 41 Input 42 43 ``` 44 5 45 2 1 46 5 2 47 10 3 48 25 4 49 15441 33 50 ``` 51 52 Output 53 54 ``` 55 Utkarsh 56 Ashish 57 Utkarsh 58 Utkarsh 59 Ashish 60 ``` 61 62 Note 63 64 In the first test case, one possible sequence of moves can be 65 66 $(0, 0) \xrightarrow{\text{Ashish }} (0, 1) \xrightarrow{\text{Utkarsh }} (0, 2)$. 67 68 Ashish has no moves left, so Utkarsh wins. 69 70 