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

22035번 - Bus Lines 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB71453867.857%

문제

After many years without any public transport, the town Krockholm will finally get a network of bus lines. The plans are still on the drawing board, but it has been decided that there shall be $n$ stations labelled 1ドル$ to $n,ドル and $m$ bus lines where each line connects two stations. The only thing remaining is to decide which pairs of stations should be connected. One important requirement is that it should be possible to get from any station to any other. In addition to this, someone had the brilliant idea that the bus lines should be labelled by the sum of their endpoints. This means that all of these sums must be different.

You are given two integers $n$ and $m$. Construct a graph with $m$ edges and $n$ vertices labelled 1ドル$ to $n,ドル such that:

  1. The graph is connected.
  2. The sums of edge endpoints are distinct.

입력

The input consists of a single line containing two integers $n$ and $m$ (2ドル \leq n \leq 100,ドル 1ドル \leq m \leq 10^4$).

출력

If it is not possible to construct a graph with the given properties, print "-1". Otherwise, print $m$ lines where the $i$'th line contains two integers $a_i,ドル $b_i,ドル the endpoints of the $i$'th edge. If there are many possible solutions, any one of them will be accepted.

제한

예제 입력 1

4 4

예제 출력 1

2 1
2 3
4 3
4 2

예제 입력 2

10 100

예제 출력 2

-1

예제 입력 3

10 1

예제 출력 3

-1

힌트

출처

Contest > KTH Challenge > KTH Challenge 2021 B번

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

출처

대학교 대회

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

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