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

21959번 - Subway 서브태스크점수다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB68292845.902%

문제

Given an integer number K, generate a tree with minimum number of nodes such that there are exactly K pairs of nodes (X, Y), where X is an ancestor of Y.

입력

The input (from the console) will contain a single integer number, K – the number of pairs with the specified property.

출력

The output (to the console) will contain N+1 lines, representing the generated tree, the nodes being indexed from 0.

The first line will contain the number N – the number of nodes in the tree.

The following N lines will contain each 2 numbers X and T, separated by a space, with the following meaning: node T is the direct ancestor of node X. If node X doesn’t have a direct ancestor, T will have value -1.

제한

점수

For every test, you will get:

  1. 100% points if Nparticipant = Ncommittee
  2. 80% points if Nparticipant ∈ [Ncommittee+1, Ncommittee+2]
  3. P% points if Nparticipant ≥ Ncommittee + 3, where P = (Ncommittee + 3) / Nparticipant × 50

Ncommittee is the minimum number of nodes that a tree with the specified property can be generated with.

서브태스크

번호배점제한
120

0 ≤ K ≤ 50

230

0 ≤ K ≤ 500

350

0 ≤ K ≤ 109

예제 입력 1

2

예제 출력 1

3
0 -1
1 0
2 0

There are 2 pairs (X, Y), such that X is the ancestor of Y:

  1. (X,Y) = (0, 1)
  2. (X,Y) = (0, 2)

예제 입력 2

4

예제 출력 2

4
0 -1
1 0
2 0
3 2

There are 4 pairs (X, Y), such that X is the ancestor of Y:

  1. (X,Y) = (0, 1)
  2. (X,Y) = (0, 2)
  3. (X,Y) = (0, 3)
  4. (X,Y) = (2, 3)

힌트

출처

Contest > infO(1) Cup > infO(1) Cup 2019 National Round 5번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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