08. Labyrinth-8

Codeforces
IDCF92108
Time8000ms
Memory512MB
Difficulty
English · Original
Chinese · Translation
Formal · Original
See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01). [samples]
请参见问题描述:http://codeforces.com/contest/921/problem/01。 [samples]
**Definitions** Let $ n \in \mathbb{Z} $ be the number of rooms. Let $ a = (a_1, a_2, \dots, a_n) $ be a sequence of integers, where $ a_i \in \{0, 1\} $ indicates whether room $ i $ is lit ($ 1 $) or unlit ($ 0 $). **Constraints** 1. $ 1 \le n \le 10^5 $ 2. $ a_i \in \{0, 1\} $ for all $ i \in \{1, \dots, n\} $ **Objective** Find the minimum number of moves to turn off all lights, where a move consists of selecting a room $ i $ with $ a_i = 1 $, and toggling the state of all rooms in the interval $ [i - a_i + 1, i + a_i - 1] $ (clamped to $ [1, n] $). Note: Since $ a_i \in \{0,1\} $, selecting a room $ i $ with $ a_i = 1 $ toggles only room $ i $. Thus, the problem reduces to: **Count the number of rooms with $ a_i = 1 $**.
API Response (JSON)
{
  "problem": {
    "name": "08. Labyrinth-8",
    "description": {
      "content": "See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01).",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 8000,
      "memory_limit": 524288
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF92108"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01).\n\n[samples]...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "请参见问题描述:http://codeforces.com/contest/921/problem/01。\n\n[samples]...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of rooms.  \nLet $ a = (a_1, a_2, \\dots, a_n) $ be a sequence of integers, where $ a_i \\in \\{0, 1\\} $ indicates whether room $ i $ is lit ($ 1 $...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments