{"raw_statement":[{"iden":"statement","content":"The complete problemset is available on http://maratona.ime.usp.br/primfase19/provas/competicao/maratona_en.pdf\n\n"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, m, k \\in \\mathbb{Z}^+ $ denote the number of planks, number of colors, and maximum allowed segment length, respectively.  \nLet $ A = (a_1, a_2, \\dots, a_m) \\in \\mathbb{Z}^m $ be the vector of paint amounts, where $ \\sum_{i=1}^m a_i = n $ and $ 1 \\le a_i \\le n $.\n\n**Constraints**  \n1. $ 1 \\le n \\le 2 \\cdot 10^5 $  \n2. $ 1 \\le m, k \\le n $  \n3. $ 1 \\le a_i \\le n $ for all $ i \\in \\{1, \\dots, m\\} $  \n4. $ \\sum_{i=1}^m a_i = n $  \n5. Each plank must be assigned exactly one color $ i \\in \\{1, \\dots, m\\} $  \n6. No contiguous segment of planks with the same color may exceed length $ k $\n\n**Objective**  \nFind a sequence $ C = (c_1, c_2, \\dots, c_n) \\in \\{1, \\dots, m\\}^n $ such that:  \n- For each color $ i $, the number of indices $ j $ with $ c_j = i $ is exactly $ a_i $,  \n- Every maximal contiguous subsequence of equal values in $ C $ has length at most $ k $,  \n\nor output $-1$ if no such sequence exists.","simple_statement":"You are given n planks in a row and m paint colors. Each color i can be used on exactly a_i planks, and the total of all a_i is n. You must paint each plank with one color so that no same-color segment is longer than k planks. If possible, output any valid coloring; if not, output -1.","has_page_source":false}