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

19370번 - Spanning Trees 스페셜 저지다국어

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

문제

Consider a complete graph with $N$ vertices. Find $K$ spanning trees that are edge-disjoint.

The leftmost figure above shows a complete graph with four vertices. The two figures to the right are two edge-disjoint spanning trees of this graph.

입력

You are given two integers $N$ and $K$ on a single line (2ドル \le N \le 10^4,ドル 1ドル \le K \le 100$).

출력

If there is no tuple of $K$ spanning trees that satisfies the conditions, print $-1$.

Otherwise, print $K$ spanning trees. Each spanning tree must be printed on $N - 1$ lines. The $i$-th line must contain two space-separated integers: the two endpoints of the $i$-th edge. The vertices are numbered 1ドル$ through $N$. You may print an empty line between consecutive trees.

제한

예제 입력 1

4 2

예제 출력 1

1 2
1 4
2 3
1 3
2 4
3 4

예제 입력 2

4 3

예제 출력 2

-1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2017 > Day 3: Japanese Contest, Head of Republic of Karelia Cup, Round I A번

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

출처

대학교 대회

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

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