[Codeforces] Codeforces Round #668 (Div. 2) C. Balanced Bitstring
k-balanced な文字列は次の条件を満たします。\( s_i = 0 \) のとき、\(a_i = -1 \) とし、\(s_i = 1 \) のとき、\(a_i = 1 \) とすると、
\begin{eq ...
[Codeforces] Codeforces Round #668 (Div. 2) B. Array Cancellation
\( i < j \) のとき、\( a_i \leftarrow a_i – 1 \)、\( a_j \leftarrow a_j + 1\) という操作は \( 0 \) コストでできますが、\( i & ...
[Codeforces] Codeforces Round #668 (Div. 2) A. Permutation Forgery
順列 \( p \) と異なる順列 \( p^{\prime} \) が \( F(p) = F(p^{\prime}) \) となるような \( p^{\prime} \) を見つけます。
\( F(p) \) ...
[Codeforces] Codeforces Round #666 (Div. 2) C. Multiples of Length
\( a_i + (n – 1)a_i = na_i \) となることを利用して、\( 1 \leq i \leq n – 1 \) となる \( i\) について、\( (n-1)a_i \) を加算 ...
[Codeforces] Codeforces Round #666 (Div. 2) B. Power Sequence
配列 \( a \) を昇順に並び替えて考えます。自然数 \( x \) を選んだ時のコストを \( f(x) \) とすると、
\
となります。ここで、\( x = (f(1) + a_{n-1})^ ...
[Codeforces] Educational Codeforces Round 94 (Rated for Div. 2) C. Binary String Reconstruction
文字列 \( w \) と自然数 \( x \) が与えられたとき次の条件を満たす文字列 \( w \) を答えます。
\( i – x \geq 0 \wedge w_{i-x} = 1 \) ならば \( ...
[Codeforces] Educational Codeforces Round 94 (Rated for Div. 2) B. RPG Protagonist
許容重量 \( p \) のリュック1と許容重量 \( f \) のリュック2があります。重さが \( s \) と \( w \) のモノがそれぞれ \( a \) 個と \( b \) 個あるとき、二つのリュックに入 ...
[Codeforces] Educational Codeforces Round 94 (Rated for Div. 2) A. String Similarity
同じ長さの文字列 \( s \) と \( t \) が ‘similar’ である条件は、\( s_i = t_i \) となる整数 \( i \) が存在することです。
長さ \( 2n ...
[Codeforces] Codeforces Round #614 (Div. 2) B. JOE is on TV!
\( i \) 回目の質問で脱落する人数を \( a_i \) とし、\( a_i \) の累積和 \( s_i \) を \( s_i = a_1 + a_2 + \cdots a_i \) とします。このとき、得られる賞金 ...
[Codeforces] Codeforces Round #614 (Div. 2) A. ConneR and the A.R.C. Markland-N
\( n \) 階建てビルの \( s \) 階から一番近いレストランを探します。フロア \( a_i \) のレストランは閉店しているので、\( s – k \) から \( s + k \) の範囲を全探索を行 ...