I. MaratonIME divides fairly

Codeforces
IDCF10137I
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
In a country trip, the contestants decided to play a soccer match. Yan, who was a professional player once, decided not to play to keep the teams balanced. He wanted to participate in another way, so he decided to choose the two teams. Unfortunately, unlike soccer, Yan is very bad at math and doesn't know if he divided the teams fairly. Yan considers a division fair if the absolute difference between the number of players in each team is minimum. Can you help him? The first line has a single integer T, the number of test cases. The next T lines have two integers a and b, the number of players in each team. Print T lines, one for each test case. If Yan was fair, output the word "Ok". If Yan wasn't fair, output two integers x and y, x ≤ y, the sizes of the teams in a fair division. ## Input The first line has a single integer T, the number of test cases. The next T lines have two integers a and b, the number of players in each team. 1 ≤ T ≤ 1000. 0 ≤ a, b ≤ 109. ## Output Print T lines, one for each test case.If Yan was fair, output the word "Ok".If Yan wasn't fair, output two integers x and y, x ≤ y, the sizes of the teams in a fair division. [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, b_k \in \mathbb{Z}^+ $ denote the number of players in the two teams. **Constraints** 1. $ 1 \le t \le 1000 $ 2. $ 1 \le a_k, b_k \le 1000 $ for all $ k \in \{1, \dots, t\} $ **Objective** For each test case $ k $: - Let $ s = a_k + b_k $ be the total number of players. - A fair division minimizes the absolute difference between team sizes. - If $ s $ is even, the fair division is $ \left( \frac{s}{2}, \frac{s}{2} \right) $. - If $ s $ is odd, the fair division is $ \left( \left\lfloor \frac{s}{2} \right\rfloor, \left\lceil \frac{s}{2} \right\rceil \right) $. Let $ x_k = \left\lfloor \frac{a_k + b_k}{2} \right\rfloor $, $ y_k = \left\lceil \frac{a_k + b_k}{2} \right\rceil $. - If $ (a_k, b_k) = (x_k, y_k) $ or $ (b_k, a_k) = (x_k, y_k) $, output **"Ok"**. - Otherwise, output $ x_k $ and $ y_k $ with $ x_k \le y_k $.
API Response (JSON)
{
  "problem": {
    "name": "I. MaratonIME divides fairly",
    "description": {
      "content": "In a country trip, the contestants decided to play a soccer match. Yan, who was a professional player once, decided not to play to keep the teams balanced. He wanted to participate in another way, so ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10137I"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "In a country trip, the contestants decided to play a soccer match. Yan, who was a professional player once, decided not to play to keep the teams balanced. He wanted to participate in another way, so ...",
      "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\\} $, let $ a_k, b_k \\in \\mathbb{Z}^+ $ denote the number of players in the two teams....",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments