CSES - DatatÃ¤hti 2016 alku - Results
 Task: Osajono Sender: siirikuoppala Submission time: 2015-10-08 12:12:17 Language: Python3 Status: READY Result: 0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.08 s1details
#20.08 s1details
#30.08 s1details
#40.09 s1details
#50.07 s1details
#60.51 s2details
#7--2details
#80.07 s2details
#90.08 s2details
#100.07 s2details
#11--3details
#12--3details
#130.10 s3details
#140.11 s3details
#150.11 s3details

### Code

```'''
Created on 30.9.2015

@author: siiri
'''

bitit = str(input())

def muuna():
k=1
joku=[]
for i in range(1, len(bitit)):
if bitit[i] == bitit[i-1]:
k+=1
else:
if k > 1:
joku.append(1)
if k < 2:
joku.append(0)
k = 1
if i == len(bitit)-1:
if k>1:
joku.append(1)
else:
joku.append(0)

return(joku)

joku = muuna()

def yks(joku, teko):
joku = dele(1)
teko.append(1)
return(teko, joku)

def dele(lol):
if lol>0 and lol < len(joku)-1:
joku.pop(lol-1)
joku.pop(lol-1)
joku.pop(lol-1)
joku.insert(lol-1, 1)
elif lol ==0:
joku.remove(joku[lol])
else:
joku[lol]=5
joku.remove(5)
return joku
def pisinnol():
i=0
d = 0
a=0
g=0
yk=0
b=len(joku)
while i < b:
if joku[i] == 0:
if d==0:
g=i
d+=1
else:
if d>a:
a=d
gg=g
YK=yk
elif d==a:
e=b/2
if i <= e:
a=d
gg=g
YK=yk
elif i > e and i-e < e-gg:
a=d
gg=g
YK=yk
d=0
yk+=1
i+=1
if d>a:
a=d
gg=g
YK=yk
return gg,a, YK, yk
def Mm(joku, teko):
gg, a, f, yk = pisinnol()
g = yk-f
if f<g:
s=gg+a
teko += str(f+1)
teko += " "
joku=dele(s)
else:
s=gg-1
teko += str(f)
teko += " "
joku=dele(s)
return teko, joku

teko = ""
f = 0
while 1 in joku:
if 0 not in joku:
r=len(joku)
while r>0:
joku.remove(1)
teko += "1"
teko += " "
r-=2
else:
teko, joku = Mm(joku, teko)

def prin():
if len(joku) > 0:
print("QAQ")
else:
print(int(len(teko)/2))
hei = ""
for q in teko:
hei += str(q)
hei += " "
hei.rstrip()
print(teko)

prin()

```

### Test details

#### Test 1

Group: 1

Verdict:

input
BBBAABBBAAAABBAAAABAABAABBBBBB...

correct output
2554

user output
39
17 16 16 17 13 15 16 13 13 14 ...

#### Test 2

Group: 1

Verdict:

input
GDFVYWQCZAFGICSXOSWBZMGPDBSSVL...

correct output
299

user output
49
2 2 2 2 2 2 2 2 2 2 2 2 1 2 1 ...

#### Test 3

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAZAAAA...

correct output
4314

user output
9
3 3 3 3 2 3 1 1 1

#### Test 4

Group: 1

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4231

user output
11
5 6 6 4 5 5 1 1 1 1 1

#### Test 5

Group: 1

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5050

user output
1

#### Test 6

Group: 2

Verdict:

input
BBABABBBABBAABBABBABAABAAABABA...

correct output
6253029

user output
2513
477 874 887 477 874 887 1012 8...

#### Test 7

Group: 2

Verdict:

input
RBKJMLDVQMKHYKCNDIVVKOMFUXTFMG...

correct output
485173

user output
(empty)

#### Test 8

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12427725

user output
17
8 9 7 8 6 7 5 6 4 5 3 4 2 3 1 ...

#### Test 9

Group: 2

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12467549

user output
9
4 5 3 4 2 3 1 1 1

#### Test 10

Group: 2

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
12502500

user output
1

#### Test 11

Group: 3

Verdict:

input
BAAAAABABBABAABAABABABBBABBAAB...

correct output
2500051369

user output
(empty)

#### Test 12

Group: 3

Verdict:

input
ABBURXDRVXAYBPXXOQZNYHLWGUEEWR...

correct output
192407124

user output
(empty)

#### Test 13

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998050400

user output
24
11 10 11 9 10 8 9 7 8 6 7 5 6 ...

#### Test 14

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998850144

user output
14
7 6 7 5 6 4 5 3 4 2 3 1 1 1

#### Test 15

Group: 3

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5000050000

user output
1