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

Molekule

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

의견: 0

설명

\(3^{rd}\) round, November \(28^{th}\) 2015
Scientists in a chemical lab in Croatia have been studying the chemical bonds between different mole-
cules. They have a special interest in a group of molecules of the chemical compound nitro hydrogen
laminate.
The compound consists of \(N\) molecules bound together by \(N - 1\) covalent bonds and all the molecules
are directly or indirectly tied together with bonds in a single structure.
The scientists want to modify the compound in a way that all the covalent bonds are transformed into
directed covalent bonds. Because of the instability of the newly created compound, each molecule will
have a large number of impulses coming out of it and travelling to other molecules using the directed
bonds. An impulse can travel using the directed covalent bond only in the direction of the bond itself.
The instability of the compound is defined as the largest possible number of bonds a single impulse
can use to travel. The scientists want to direct the compound’s covalent bonds in a way that the newly
created compound is as stable as possible. In other words, their goal is to create a compound with the
minimal longest path an impulse can take during its travel.
Help the scientists determine the direction of each covalent bond in the compound.

제약

In test cases worth at least 30% of total points, it will hold \(N\) ⩽20.
\(3^{rd}\) round, November \(28^{th}\) 2015

입력 형식

The first line of input contains the integer \(N\) (2 ⩽\(N\) ⩽100 000).
Each of the \(N - 1\) lines contains the integers \(a@@RISE_MATH_BLOCK_0@@i\) (1 ⩽\(a@@RISE_MATH_BLOCK_1@@i\)
and \(b\)\(i\) are connected with a covalent bond.

출력 형식

Output \(N - 1\) lines, where each line must contain 1 if the covalent bond is going to be directed from
\(a@@RISE_MATH_BLOCK_0@@i\), otherwise it contains 0.
If there are multiple possible solutions, output any.

예제 1
입력
3
1 2
2 3
출력
0
1
예제 2
입력
4
2 1
1 3
4 1
출력
1
0
1
문제 정보

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

출처 COCI 2015/2016 Contest 3

평가 및 의견

Molekule

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

Log in to rate problems.

개별 의견

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

풀이 제출

Molekule

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