Logo
(追記) (追記ここまで)

13955번 - Key Knocking 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB241705440.909%

문제

Goran is recovering from his knee surgery and is experimenting with a smart card used for storing cryptographic keys. In this problem, a key is a bitstring of size 3n where n is a positive integer. Particular bits of the key are indexed with integers 1 through 3n left to right. Weight of a key is the number of pairs of different neighbouring bits increased by one. For example, the weight of the key “000” is 1, while the weight of the key “011010100” is 7.

He has discovered that he can tamper with the key by sending small jolts of electricity through the circuits of the smart card. In particular, he can reliably perform the following operation: pick two arbitrary neighbouring bits of the key and flip both of them. For example, one operation can change the key “000” to “110”.

Given a key of size 3n find any sequence of at most n operations that transforms the given key to a key of weight at least 2n. You may assume that a solution always exists.

입력

The first line contains a string consisting of digits “0” and “1” — the initial key. The length of the key is 3n where n is a positive integer such that 1 ≤ n ≤ 100 000.

출력

The first line should contain an integer m where 0 ≤ m ≤ n — the number of operations in your solution. The following line should contain m integers a1, a2, . . . , am describing your solution. The number ak is the index of the left one of two bits being flipped in the k-th step.

If the initial key already has weight at least 2n you may output only the integer 0.

제한

예제 입력 1

000000000

예제 출력 1

3
2 5 6

예제 입력 2

111001000111

예제 출력 2

2
3 9

예제 입력 3

010101

예제 출력 3

0

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2016 K번

Contest > Open Cup > 2016/2017 Season > Stage 8: Grand Prix of Europe K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /