RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00409

Burza

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

1 \(s / 512\) \(MB / 160\) points

Daniel is tired of looking for a job, so he decided to visit his friend Stjepan. Surprisingly,
when he entered Stjepan’s home, he came across a tree with \(N\)

nodes denoted with
numbers from 1 to \(N\)

. The node number 1 contains a coin.

Stjepan told him: “ Put this blindfold on and we’ll play!

” Daniel gave him a strange look, but
decided to do it. Stjepan then told him the rules of the game:

Daniel picks a node and marks it

Stjepan moves the coin to an unmarked node adjacent to the one where the
coin is currently in

Stjepan marks the node which he moved the coin from

These three steps repeat until Stjepan can’t make a move anymore. Given the fact that he is
blindfolded, Daniel doesn’t exactly know what node contains the coin in any given moment of
the game. However, he does know the outline of the tree and where the coin was at the
beginning of the game.

Daniel just realized that he hasn’t applied to a single job for the past two hours, and wants to
quickly finish playing the game. Now he wants to know if he can play in a way that, no
matter what moves Stjepan makes , the game ends in at most k moves . In other words,
so that Stjepan moves the coin less than k times .

Help Daniel and determine whether he can finish the game on time and go back to sending
his resume to companies he’s never heard of.

제약
입력 형식

The first line of input contains two integers, \(N\)

and K.

(1 ≤ \(K\)

\(N\)

≤ 400)
Each of the following \(N - 1\)

lines contains two integers \(A\)

and \(B\)

(1 ≤ A, B

\(N\)

) that denote
that an undirected link exists between nodes labeled with \(A\)

and \(B\)

.
It is guaranteed that the given graph will be a tree.

출력 형식

The first and only line of output must contain the word “DA” (Croatian for yes), without
quotation marks, if Daniel can ensure that the game ends in at most \(K\)

moves, and “NE”
(Croatian for no) if he can’t.

1 \(s / 512\) \(MB / 160\) points

예제 1
입력
6 2
1 2
2 3
3 4
1 5
5 6

3 1
1 2
1 3

8 2
1 2
2 3
2 4
5 6
6 8
1 5
7 1
출력
output
output
DA

NE

DA
설명

Clarification of the second test case:
Daniel can mark any node. If he marks node 1 or 2, Stjepan can move the coin to node 3, and if he
marks node 3, Stjepan can move the coin to node 2.

Clarification of the third test case:
In his first move, Daniel can mark node 2, and in the second move mark node 6. Wherever Stjepan
moves the coin in his first move, he won’t be able to make a second move.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2016/2017 Contest 2

평가 및 의견

Burza

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Burza

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8