036. Speed Limits

Codeforces
IDCF10269036
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You are going on a long road trip, and want to know what the maximum speed limit is in each state that you are traveling through. The first line of input contains a positive integer _S_, indicating the number of states that are in the database. The next _S_ lines each contain a string representing the name of the state, a space, and an integer representing the maximum speed limit in that state. Names of states will not contain spaces. The next line of input contains a positive integer _T_ indicating the number of test cases that follow. Each test case will consist of a state name. For each of the _T_ test cases, output a single integer: the maximum speed limit in the given state, from the database. ## Input The first line of input contains a positive integer _S_, indicating the number of states that are in the database. The next _S_ lines each contain a string representing the name of the state, a space, and an integer representing the maximum speed limit in that state. Names of states will not contain spaces. The next line of input contains a positive integer _T_ indicating the number of test cases that follow. Each test case will consist of a state name. ## Output For each of the _T_ test cases, output a single integer: the maximum speed limit in the given state, from the database. [samples]
**Definitions** Let $ S \in \mathbb{Z}^+ $ be the number of states in the database. Let $ D = \{ (s_i, v_i) \mid i \in \{1, \dots, S\} \} $ be the database, where: - $ s_i $ is a string denoting the name of state $ i $, - $ v_i \in \mathbb{Z}^+ $ is the maximum speed limit in state $ s_i $. Let $ T \in \mathbb{Z}^+ $ be the number of test cases. Let $ Q = (q_1, q_2, \dots, q_T) $ be a sequence of state names (queries), where each $ q_j $ is a string. **Constraints** 1. $ 1 \le S \le 100 $ 2. $ 1 \le T \le 100 $ 3. Each $ s_i $ and $ q_j $ is a non-empty string without spaces. 4. Each $ v_i \in \{1, 2, \dots, 150\} $ **Objective** For each query $ q_j \in Q $, output the speed limit $ v_i $ such that $ (s_i, v_i) \in D $ and $ s_i = q_j $.
API Response (JSON)
{
  "problem": {
    "name": "036. Speed Limits",
    "description": {
      "content": "You are going on a long road trip, and want to know what the maximum speed limit is in each state that you are traveling through.  The first line of input contains a positive integer _S_, indicating ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269036"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are going on a long road trip, and want to know what the maximum speed limit is in each state that you are traveling through. \n\nThe first line of input contains a positive integer _S_, indicating ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ S \\in \\mathbb{Z}^+ $ be the number of states in the database.  \nLet $ D = \\{ (s_i, v_i) \\mid i \\in \\{1, \\dots, S\\} \\} $ be the database, where:  \n- $ s_i $ is a string denoting...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments