English · Original
Chinese · Translation
Formal · Original
A binary string is a non-empty sequence of $0$'s and $1$'s, e.g., _010110_, _1_, _11101_, etc. The edit distance of two binary strings $S$ and $T$, denoted by $e d i t (S, T)$, is the minimum number of single-character edit (insert, delete, or substitute) to modify $S$ into $T$. For example, the edit distance of _0011_ and _1100_ is $4$, i.e. _0011_ $arrow.r$ _011_ $arrow.r$ _11_ $arrow.r$ _110_ $arrow.r$ _1100_. The edit distance of _1100101_ and _1110100_ is $2$, i.e. _1100101_ $arrow.r$ _1110101_ $arrow.r$ _1110100_.
Ayu has a binary string $S$. She wants to find a binary string with the same length as $S$ that maximizes the edit distance with $S$. Formally, she wants to find a binary string $T_{m a x}$ such that $| S | = | T_{m a x} |$ and $e d i t (S, T_{m a x}) >= e d i t (S, T ')$ for all binary string $T '$ satisfying $| S | = | T ' |$.
She needs your help! However, since she wants to make your task easier, you are allowed to return any binary string $T$ with the same length as $S$ such that the edit distance of $S$ and $T$ is more than half the length of $S$. Formally, you must return a binary string $T$ such that $| S | = | T |$ and $e d i t (S, T) > frac(| S |, 2)$.
Of course, you can still return $T_{m a x}$ if you want, since it can be proven that $e d i t (S, T_{m a x}) > frac(| S |, 2)$ for any binary string $S$. This also proves that there exists a solution for any binary string $S$. If there is more than one valid solution, you can output any of them.
Input contains a binary string $S$ ($1 <= | S | <= 2000$).
Output in a line a binary string $T$ with the same length as $S$ that satisfies $e d i t (S, T) > frac(| S |, 2)$.
_Explanation for the sample input/output #1_
As illustrated in the example above, the edit distance of _0011_ and _1100_ is $4$. Since $4 > frac(4, 2)$, _1100_ is one of the valid output for this sample.
## Input
Input contains a binary string $S$ ($1 <= | S | <= 2000$).
## Output
Output in a line a binary string $T$ with the same length as $S$ that satisfies $e d i t (S, T) > frac(| S |, 2)$.
[samples]
## Note
_Explanation for the sample input/output #1_As illustrated in the example above, the edit distance of _0011_ and _1100_ is $4$. Since $4 > frac(4, 2)$, _1100_ is one of the valid output for this sample.
[{"iden":"statement","content":"Gaby 是一个喜欢玩数字的小宝宝。最近她学会了使用标准加法算法来计算两个数的和,该算法可总结为以下三个步骤:\n\n这意味着当我们加两个数时,会得到类似以下的结果:\n\n不幸的是,由于 Gaby 太小,她不知道第三步的含义,因此她省略了这一步,使用了她自己的标准算法(Gaby 加法算法)。当在必要时忽略进位来加两个数时,她会得到类似以下的结果:\n\nGaby 非常喜欢玩数字,因此她想用一组数字练习她刚学到的算法(以她学会的方式),通过计算每一对数字的和,寻找产生最大值和最小值的那一对。\n\n她需要检查自己是否做得正确,因此她请求你帮助她找出使用 Gaby 加法算法从这组数字中能生成的最大值和最小值。\n\n输入的第一行是一个整数 #cf_span[n](#cf_span[2 ≤ n ≤ 106]),表示 Gaby 将要使用的整数个数。下一行包含 #cf_span[n] 个用空格分隔的数字 #cf_span[ni](#cf_span[0 ≤ ni ≤ 1018])。\n\n请输出使用 Gaby 加法算法从列表中选取两个数相加所能得到的最小值和最大值。\n\n在第一个样例输入中,以下是得到最小值和最大值的方法:\n\n"},{"iden":"input","content":"The input starts with an integer #cf_span[n] (#cf_span[2 ≤ n ≤ 106]) indicating the number of integers Gaby will be playing with. The next line contains #cf_span[n] numbers #cf_span[ni] (#cf_span[0 ≤ ni ≤ 1018]) separated by a single space."},{"iden":"output","content":"Output the smallest and the largest number you can get from adding two numbers from the list using Gaby's addition algorithm."},{"iden":"examples","content":"Input617 5 11 0 42 99Output0 99Input7506823119072235413 991096248449924896 204242310783332529 778958050378192979 384042493592684633 942496553147499866 410043616343857825Output52990443860776502 972190360051424498"},{"iden":"note","content":"In the first sample input this is how you get the minimum and the maximum value "}]
The provided JSON structure is already correctly formatted and contains only the necessary fields. The translation of the natural language content has been performed as per the instructions, preserving all mathematical expressions and Typst commands exactly as-is.
Note: The input/output/examples/note fields that are originally in English are left untranslated as per the requirement — only the natural language parts in the "statement" field were translated, and all other fields (including those labeled as input/output) were kept unchanged since they are either machine-readable or already in English.
The output is a valid, structurally identical JSON array as required.
**Definitions**
Let $ n \in \mathbb{Z} $ be the number of kills.
Let $ K = ((a_1, b_1), (a_2, b_2), \dots, (a_n, b_n)) $ be the sequence of kills, where $ a_i $ is the killer and $ b_i $ is the victim in the $ i $-th kill.
Let $ P $ be the set of all unique player names.
Let $ T_1, T_2 \subseteq P $ be the two teams, each of size 5, with $ T_1 \cap T_2 = \emptyset $ and $ T_1 \cup T_2 = P $.
**Constraints**
1. $ 1 \le n \le 1000 $
2. For all $ i \in \{1, \dots, n\} $, $ a_i, b_i \in P $, $ a_i \ne b_i $, and $ a_i, b_i $ belong to different teams.
3. Each string $ a_i, b_i $ has length at most 100.
**Objective**
Determine if there exists a player $ p \in P $ and a contiguous subsequence of kills $ (a_j, b_j), (a_{j+1}, b_{j+1}), \dots, (a_{j+4}, b_{j+4}) $ for some $ j \in \{1, \dots, n-4\} $, such that:
- $ a_j = a_{j+1} = \dots = a_{j+4} = p $, and
- $ \{b_j, b_{j+1}, b_{j+2}, b_{j+3}, b_{j+4}\} $ contains exactly five distinct players.
If such a subsequence exists, output _PENTA KILL!_; otherwise, output _SAD:(_.
$$
\exists p \in P,\ \exists j \in \{1, \dots, n-4\} \text{ s.t. }
\left( \bigwedge_{i=0}^{4} a_{j+i} = p \right) \land \left( \left| \{ b_{j}, b_{j+1}, b_{j+2}, b_{j+3}, b_{j+4} \} \right| = 5 \right)
$$
API Response (JSON)
{
"problem": {
"name": "A. Edit Distance",
"description": {
"content": "A binary string is a non-empty sequence of $0$'s and $1$'s, e.g., _010110_, _1_, _11101_, etc. The edit distance of two binary strings $S$ and $T$, denoted by $e d i t (S, T)$, is the minimum number o",
"description_type": "Markdown"
},
"platform": "Codeforces",
"limit": {
"time_limit": 1000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "CFA"
},
"statements": [
{
"statement_type": "Markdown",
"content": "A binary string is a non-empty sequence of $0$'s and $1$'s, e.g., _010110_, _1_, _11101_, etc. The edit distance of two binary strings $S$ and $T$, denoted by $e d i t (S, T)$, is the minimum number o...",
"is_translate": false,
"language": "English"
},
{
"statement_type": "Markdown",
"content": "[{\"iden\":\"statement\",\"content\":\"Gaby 是一个喜欢玩数字的小宝宝。最近她学会了使用标准加法算法来计算两个数的和,该算法可总结为以下三个步骤:\\n\\n这意味着当我们加两个数时,会得到类似以下的结果:\\n\\n不幸的是,由于 Gaby 太小,她不知道第三步的含义,因此她省略了这一步,使用了她自己的标准算法(Gaby 加法算法)。当在必要时忽略进位来加两个数时,她会得到类...",
"is_translate": true,
"language": "Chinese"
},
{
"statement_type": "Markdown",
"content": "**Definitions** \nLet $ n \\in \\mathbb{Z} $ be the number of kills. \nLet $ K = ((a_1, b_1), (a_2, b_2), \\dots, (a_n, b_n)) $ be the sequence of kills, where $ a_i $ is the killer and $ b_i $ is the vi...",
"is_translate": false,
"language": "Formal"
}
]
}