G. 007: You Only Live Thrice

Codeforces
IDCF10253G
Time3000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Dr. Evil is up to his evil antics again and has traveled back in time to 1975 to enact his evil schemes. The British Intelligence Agency needs someone to travel back in time as well to thwart his convoluted plot. Seeing the opportunity to be part of an adventure that involves riveting mysteries, amorous escapades, and gratuitous violence, you volunteer for the role of 007. What the British Intelligence Agency failed to tell you was that in this iteration, not only will you be agent 007. You will also be 007 years old and do 007-year-old things. As part of your role, you will receive encrypted messages with a secret marker and you have to decode whether it's meant for Agent 003, Agent 005, or Agent 007 (you). The marker will be divisible by 3 if it's meant for Agent 003, divisible by 5 if it's meant for Agent 005, and 7 if it's meant for Agent 007. Since you retained your mental maturity, you want to avoid doing tedious tasks equivalent to homework for 007-year-olds. You want to leave it to a computer to do the job. The program you write must accept a number $m$ (the secret marker) and output _AGENT 003_ if it's divisible by 3, _AGENT 005_ if it's divisible by 5, and _AGENT 007_ if it's divisible by 7. The first line of input contains a single integer $t$, the number of test cases. Each test case consists of a single line containing a single integer, $m$. *Constraints* $1 <= t <= 10^5$ $1 <= m <= 10^(18)$ For each test case, output several lines. For each agent the message is meant for—_AGENT 003_, _AGENT 005_, and/or _AGENT 007_—output the agent's name in a single line. If the message is meant for none of you, output _NONE_. If the message is meant for more than one of you, output each agent in the following order: _AGENT 003_, _AGENT 005_, and/or _AGENT 007_. At the end of the output for each test case, output a single line containing three dashes: _—_ ## Input The first line of input contains a single integer $t$, the number of test cases. Each test case consists of a single line containing a single integer, $m$. *Constraints*$1 <= t <= 10^5$$1 <= m <= 10^(18)$ ## Output For each test case, output several lines. For each agent the message is meant for—_AGENT 003_, _AGENT 005_, and/or _AGENT 007_—output the agent's name in a single line. If the message is meant for none of you, output _NONE_. If the message is meant for more than one of you, output each agent in the following order: _AGENT 003_, _AGENT 005_, and/or _AGENT 007_. At the end of the output for each test case, output a single line containing three dashes: _—_ [samples]
**Definitions** Let $ t \in \mathbb{Z} $ be the number of test cases. For each test case $ k \in \{1, \dots, t\} $: - Let $ a_k \in \mathbb{Z} $ be the total number of available actors. - Let $ g_k \in \mathbb{Z} $ be the number of cast slots per movie. - Let $ n_k \in \mathbb{Z} $ be the total number of movie episodes. - Let $ C_{k,1} = (c_{k,1,1}, c_{k,1,2}, \dots, c_{k,1,g_k}) $ be the initial cast list for episode 1, where $ c_{k,1,i} \in \{ \text{actor names} \} $. - Let $ A_k = \{ \alpha_1, \alpha_2, \dots, \alpha_{a_k} \} $ be the set of all available actors. **Constraints** 1. $ 1 \le t \le 100 $ 2. For each $ k \in \{1, \dots, t\} $: - $ 1 \le g_k \le a_k \le 100 $ - $ 2 \le n_k \le 100 $ - Each actor in $ C_{k,1} $ is in $ A_k $ **Objective** For each test case $ k $, produce a sequence of $ n_k - 1 $ cast transitions $ T_k = (T_{k,2}, T_{k,3}, \dots, T_{k,n_k}) $, where each transition $ T_{k,j} = (a_{\text{out}}, a_{\text{in}}) $ satisfies: - $ a_{\text{out}} \in C_{k,j-1} $ (an actor currently in the cast) - $ a_{\text{in}} \in A_k \setminus C_{k,j-1} $ (an actor not currently in the cast) - $ C_{k,j} $ is obtained by replacing $ a_{\text{out}} $ with $ a_{\text{in}} $ in $ C_{k,j-1} $ Output $ n_k - 1 $ such transitions, one per line, for each test case. Output a blank line before each test case’s output except the first.
API Response (JSON)
{
  "problem": {
    "name": "G. 007: You Only Live Thrice",
    "description": {
      "content": "Dr. Evil is up to his evil antics again and has traveled back in time to 1975 to enact his evil schemes. The British Intelligence Agency needs someone to travel back in time as well to thwart his conv",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10253G"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Dr. Evil is up to his evil antics again and has traveled back in time to 1975 to enact his evil schemes. The British Intelligence Agency needs someone to travel back in time as well to thwart his conv...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ t \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, t\\} $:  \n- Let $ a_k \\in \\mathbb{Z} $ be the total number of available actors.  \n- Let ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments