포럼
문제 ICPC00187

J. Juggling Troupe

설명

At the national centre for computing and advanced circus skills, technical demonstrations by students are strongly encouraged.

A troupe of \(n\) novice performers are at this very moment arrayed in a row attempting to put on a juggling show. Unfortunately, none of them are very confident in their craft, and they are struggling. Thus, as soon as an opportunity presents itself, they will try to reduce their part in the performance to make the task easier.

Whenever a juggler has more than one ball in their possession, they will throw one ball to each of their neighbours. In the case that a juggler does not have a neighbour in some direction, they will simply throw the ball offstage instead. Everybody throws their juggling balls simultaneously. The show ends when no juggler has more than one ball.

See Figure below for an illustration of this process.

As a member of the audience, you are not impressed by this performance. However, you do wonder how many balls each of the jugglers will have left at the end of the show.

제약
입력 형식

The input consists of:
- One line with a string \(s\) of length \(n\) \((1 \leq n \leq 10^6)\) over the characters 0, 1 and 2. The \(i\)th character in \(s\) represents the number of juggling balls initially held by the \(i\)th person.

출력 형식

Output a string \(s\) of length \(n\) over the characters 0 and 1, the \(i\)th giving the number of juggling balls the \(i\)th person has at the end of the show.

예제 1
입력
12100212
출력
10111111
예제 2
입력
000111222000222111222001
출력
111111101111111111111111
문제 정보

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

출처 ICPC NWERC 2017

평가 및 의견

J. Juggling Troupe

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

Log in to rate problems.

개별 의견

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

풀이 제출

J. Juggling Troupe

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