Logo
(追記) (追記ここまで)

18742번 - Avg 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB75252438.710%

문제

Find a sequence of steps of the following kind (if it exists) that would make all elements of any array of real numbers a1, a2, . . . , an equal:

pick k distinct indices b1, b2, . . . , bk (1 ≤ bi ≤ n) and change the values of ab1, ab2, . . . , abk to their arithmetic mean (that is, 1/k (ab1 + ab2 + . . . + abk)) simultaneously.

입력

The only line contains two integers n and k (2 ≤ k ≤ n ≤ 1000; n is divisible by k).

출력

If a required sequence of steps doesn’t exist, display a single integer −1.

Otherwise, display the number of steps in your sequence t (1 ≤ kt ≤ 106), followed by t step descriptions. Each step description must consist of k distinct integers b1, b2, . . . , bk (1 ≤ bi ≤ n).

It can be shown that if a valid sequence of steps exists, a sequence satisfying kt ≤ 106 exists as well.

제한

예제 입력 1

4 2

예제 출력 1

4
1 2
3 4
1 3
2 4

예제 입력 2

6 3

예제 출력 2

-1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2020 > Day 7: Gennady Korotkevich Contest 5 A번

Contest > Open Cup > 2019/2020 Season > Stage 11: Grand Prix of Gomel A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /