CF271C.Secret

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The Greatest Secret Ever consists of nn words, indexed by positive integers from 11 to nn . The secret needs dividing between kk Keepers (let's index them by positive integers from 11 to kk ), the ii -th Keeper gets a non-empty set of words with numbers from the set Ui=(ui,1,ui,2,...,ui,Ui)U_{i}=(u_{i,1},u_{i,2},...,u_{i,|Ui}|) . Here and below we'll presuppose that the set elements are written in the increasing order.

We'll say that the secret is safe if the following conditions are hold:

  • for any two indexes i,ji,j ( 1<=i<j<=k ) the intersection of sets UiU_{i} and UjU_{j} is an empty set;
  • the union of sets U1,U2,...,UkU_{1},U_{2},...,U_{k} is set (1,2,...,n)(1,2,...,n) ;
  • in each set UiU_{i} , its elements ui,1,ui,2,...,ui,Uiu_{i,1},u_{i,2},...,u_{i,|Ui}| do not form an arithmetic progression (in particular, Ui>=3|U_{i}|>=3 should hold).

Let us remind you that the elements of set (u1,u2,...,us)(u_{1},u_{2},...,u_{s}) form an arithmetic progression if there is such number dd , that for all ii ( 1<=i<s ) fulfills ui+d=ui+1u_{i}+d=u_{i+1} . For example, the elements of sets (5)(5) , (1,10)(1,10) and (1,5,9)(1,5,9) form arithmetic progressions and the elements of sets (1,2,4)(1,2,4) and (3,6,8)(3,6,8) don't.

Your task is to find any partition of the set of words into subsets U1,U2,...,UkU_{1},U_{2},...,U_{k} so that the secret is safe. Otherwise indicate that there's no such partition.

输入格式

The input consists of a single line which contains two integers nn and kk ( 2<=k<=n<=1062<=k<=n<=10^{6} ) — the number of words in the secret and the number of the Keepers. The numbers are separated by a single space.

输出格式

If there is no way to keep the secret safe, print a single integer "-1" (without the quotes). Otherwise, print nn integers, the ii -th of them representing the number of the Keeper who's got the ii -th word of the secret.

If there are multiple solutions, print any of them.

输入输出样例

  • 输入#1

    11 3
    

    输出#1

    3 1 2 1 1 2 3 2 2 3 1
    
  • 输入#2

    5 2
    

    输出#2

    -1
    
首页