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

KOVANICE, 100 points

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

의견: 0

설명

CROATIAN OLYMPIAD IN INFORMATICS 2015
Time limit: 2 seconds
Memory limit: 512 MB
Page \(1/2\)
Mirko paid a touristic visit to a land far away where banknotes aren’t used, but only coins. More precisely,
the country has \(N\) types of coins in circulation. Their names are, respectively, ‘K1’, ‘K2’, ‘K3’, . . . , ‘K\(N\)’.
The coins are of the same size and shape, but different weights. ‘K1’ is the lightest type of coin, ‘K2’ is the
second lightest and so on until the heaviest type ‘KN’.
Mirko has \(M\) coins in his pocket, but he doesn’t know which one is of which type. In order to determine
that, he only has a simple balance scale at his disposal.
Initially, Mirko marked his unknown coins with numbers from 1 to \(M\) and after that performed \(V\) weighings.
In each weighing, he put one coin on one side of the scale, and another coin on the other side of the scale.
Then he saw whether the two coins weigh equally, and if they don’t, which one is heavier.
Write a programme that will, based on the weighing results, determine the type of coin for each coin for
which it is possible to determine it uniquely.

제약

subtask
subscore
constraints
1
10
\(N = 2\), 1 ⩽\(M\) ⩽1 000
2
40
\(N = 2\), 1 ⩽\(M\) ⩽300 000
3
10
1 ⩽\(M\) ⩽1 000
4
40
1 ⩽\(M\) ⩽300 000
In all subtasks, it will hold 2 ⩽\(N\) ⩽300 000 and 1 ⩽\(V\) ⩽300 000.
CROATIAN OLYMPIAD IN INFORMATICS 2015
Time limit: 2 seconds
Memory limit: 512 MB
Page \(2/2\)

입력 형식

The first line of input contains integers \(N\), \(M\) and \(V\) – the number of types of coins in the country, the
number of coins in Mirko’s pocket and the number of weighings.
Each of the following \(V\) lines contains the result of one weighing in the form of ACB where \(A\) and \(B\) are
different integers less than or equal to \(M\), and \(C\) is the character ‘=’ (equal) or ‘<’ (less).
There is no space between the numbers and character \(C\). The result of one weighing tells us that Mirko’s
coin marked with \(A\) is of equal weight as the coin marked with \(B\) or lighter than it.
The weighing results won’t be contradictory.

출력 형식

Output \(M\) lines. The \(i\)^{th} line must contain the type of coin marked with \(i\) – a sequence of characters of the
form ‘K\(X\)’ where \(X\) is an integer between 1 and \(N\).
If it isn’t possible to uniquely determine the weight of the coin marked with \(i\), output the character ‘?’ in
the \(i\)^{th} line.

예제 1
입력
3 5 3
1<2
2<4
3=5
2 7 6
1=2
2=3
2=7
3<4
4=5
4=6
출력
output
K1
K2
?
K3
?
K1
K1
K1
K2
K2
K2
K1
문제 정보

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

출처 COCI 2014/2015 Olympiad

평가 및 의견

KOVANICE, 100 points

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

Log in to rate problems.

개별 의견

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

풀이 제출

KOVANICE, 100 points

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