포럼
문제 ICPC00327

C. Corrupted Contest

설명

You are organizing a programming competition in which the rank of a team is first determined by how many problems they have solved. In case of a tie, the team with the lowest time penalty is ranked above the other. However, contrary to the BAPC, the time penalty is equal to \(t\) if the latest accepted submission was submitted in the \(t\)th minute, or \(0\) if no problem was solved.

For example, if team A solved their first problem in the \(5\)th minute, their second problem in the \(10\)th minute and their third problem in the \(60\)th minute, then their time penalty is \(60\). If team B also solved three problems, in the \(30\)th, \(40\)th and \(50\)th minute, their time penalty is \(50\) and they would rank above team A.

The contest has finished and you would like to enter the final standings. However, due to a corrupted file you have lost part of the scoreboard. In particular, the column indicating how many problems each team has solved is gone. You do still have the time penalties of all the teams and know that they are in the right order. You also remember how many problems the contest had. You wonder whether, given this information, it is possible to uniquely reconstruct the number of problems that each team has solved.

제약
입력 형식

The input consists of:
- One line containing two integers: \(n\) (\(1 \le n \le 10^4\)), the number of teams participating, and \(p\) (\(1 \le p \le 10^4\)), the number of contest problems.
- \(n\) lines with on line \(i\) the time score \(t_i\) in minutes (\(0 \le t_i \le 10^6\)) of the team that is ranked in the \(i\)th place.

A positive time score of \(t\) indicates that a team has submitted their last accepted submission in the \(t\)th minute. A time score of \(0\) indicates that a team hasn't solved any problem.

The input always originates from a valid scoreboard.

출력 형식

If it is possible to uniquely reconstruct the scores of all the teams, output \(n\) lines containing the number of problems that the \(i\)th team has solved on the \(i\)th line. Otherwise, output "ambiguous".

예제 1
입력
9 3
140
75
101
120
30
70
200
0
0
출력
3
2
2
2
1
1
1
0
0
예제 2
입력
6 3
100
40
40
50
0
0
출력
ambiguous
문제 정보

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

출처 ICPC BAPC 2020

평가 및 의견

C. Corrupted Contest

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

Log in to rate problems.

개별 의견

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

풀이 제출

C. Corrupted Contest

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