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

Sabor

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

의견: 0

설명

\(4^{th}\) round, December \(20^{th}\), 2014
A land far, far away has \(N\) Members of Parliament (MP). They had a turbulent and passionate debate
on the law on amendments to the law on a new referendum on referendums. From Monday to Friday,
all MPs joyfully came to work and argued all day.
A diligent news reporter photographed MPs at their workplace in the heat of the argument every
working day of the week. What she captured on the photos are pairs of MPs fighting and scowling at
each other. The five photographs have been forwarded to you for thorough analysis.
It is a fact that each MP belongs to one of the two political parties. Let’s denote them with letters A
and B. Your task is to estimate which MP belongs to which party, so that the following holds for your
estimation: each MP argued with at most two distinct members of their own party.

제약

In test cases worth 30% of total points, it will hold \(N\) ⩽15.
SAMPLE TEST DATA
input
input
7
2
1 2
7 3
2
1 3
7 4
2
1 4
7 5
2
1 5
7 6
2
1 6
7 2
10
3
1 2
7 3
9 4
3
1 3
7 4
9 5
3
1 4
7 5
9 6
3
1 5
7 6
9 8
3
1 6
7 8
9 10
output
output
ABBBBBA
ABBBBBAAAA

입력 형식

The first line of input contains an integer \(N\) (2 ⩽\(N\) ⩽200 000), the number of MPs. MPs are denoted
with numbers from 1 to \(N\).
The following five lines describe the photographs taken from Monday to Friday. Each of the five lines
contains the list of pairs of MPs that are arguing on the photograph that day (scowling at each other).
Stated first is the number of pairs \(P\) (1 ⩽\(P\)\(N/2\)), followed by \(P\) pairs in the form of “\(K\) \(L\)”, where
\(K\) and \(L\) are labels of MPs scowling at each other. Before each pair there is a double space.
Of course, each MP is stated at most once per line.

출력 형식

The first and only line of output must contain an array consisting of only characters \(A\) and \(B\), so that
the \(K\)^{th} character denotes the party of \(K\)^{th} MP in a division that satisfies the given conditions.
Since the solution isn’t going to be unique, output any.

예제 1
입력
7
2  1 2  7 3
2  1 3  7 4
2  1 4  7 5
2  1 5  7 6
2  1 6  7 2
출력
ABBBBBA
예제 2
입력
10
3  1 2  7 3  9 4
3  1 3  7 4  9 5
3  1 4  7 5  9 6
3  1 5  7 6  9 8
3  1 6  7 8  9 10
출력
ABBBBBAAAA
문제 정보

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

출처 COCI 2014/2015 Contest 4

평가 및 의견

Sabor

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

Log in to rate problems.

개별 의견

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

풀이 제출

Sabor

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