I. Painting a Square

Codeforces
IDCF10221I
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
There is a square of size $a times a$. In its top left corner there is a square brush of size $b times b$. You should use this brush to paint a square (you can assume that the top left corner of size $b times b$ is already painted). It is allowed to move a brush only in parallel to the square's sides. What is the minimal distance the center of the brush should pass to make the whole square painted? The input contains two integers $a$ and $b$ ($1 <= b <= a <= 10^6$) — the sides of the square and the brush, correspondingly. Output a single integer — the minimal distance that should be passed by the center of the brush. It is guaranteed that the answer is an integer. ## Input The input contains two integers $a$ and $b$ ($1 <= b <= a <= 10^6$) — the sides of the square and the brush, correspondingly. ## Output Output a single integer — the minimal distance that should be passed by the center of the brush. It is guaranteed that the answer is an integer. [samples]
**Definitions** Let the road be represented as a $3 \times 10$ grid $G$, where each row corresponds to a lane and each column to a position along the road. Let $r \in \{1,2,3\}$ denote the lane containing the RoboTaxi, uniquely identified by the symbol `'='` in that row. Let $O \in \{H, T, P\}$ be the set of obstacle types. Let $.$ denote empty space. **Constraints** 1. Each row has exactly 10 characters. 2. Exactly one row contains exactly one `'='`; all other characters in that row are either `'.'` or obstacles. 3. Obstacles and empty spaces are confined to the 10 positions in each row. **Objective** Let $c \in \{1, \dots, 10\}$ be the column index of `'='` in its row. For $i = c, c+1, \dots, 10$:  If $G[r][i] \in \{H, T, P\}$, output $G[r][i]$. If no such $i$ exists, output `You shall pass!!!`.
API Response (JSON)
{
  "problem": {
    "name": "I. Painting a Square",
    "description": {
      "content": "There is a square of size $a times a$. In its top left corner there is a square brush of size $b times b$. You should use this brush to paint a square (you can assume that the top left corner of size ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10221I"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "There is a square of size $a times a$. In its top left corner there is a square brush of size $b times b$. You should use this brush to paint a square (you can assume that the top left corner of size ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet the road be represented as a $3 \\times 10$ grid $G$, where each row corresponds to a lane and each column to a position along the road.  \nLet $r \\in \\{1,2,3\\}$ denote the lane co...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments