CSES - Datatähti 2022 alku - Results
Submission details
Task:Ositus
Sender:parasdata
Submission time:2021-10-11 09:13:57 +0300
Language:Python3 (CPython3)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.02 s1, 2, 3details
#20.03 s1, 2, 3details
#3ACCEPTED0.03 s1, 2, 3details
#4ACCEPTED0.03 s1, 2, 3details
#5--2, 3details
#6--3details
#7--3details

Code

vastaus = 0

def next1(listt):
    listt[-1] += 1
    listt[-2] -= 1
    check_group(listt)


def next2(listt):
    listt.append(1)
    listt[-2] -= 1
    check_group(listt)


def algorithm(listt):
    while listt[-1] >= 2:
        next2(listt)
        while listt[-2] != 1:
            next1(listt)
            if listt[-1] >= 2 and listt[-2] != 1:
                copy2 = listt.copy()
                algorithm(copy2)


def check_group(group):
    global vastaus
    valid = True
    new_group = []
    i = 0
    for size in group:
        if size == 0:
            return
        sett = ""
        while size > 0:
            sett += text[i]
            size -= 1
            i += 1
        check = list(sett)
        if len(set(check)) < len(check):
            valid = False
        new_group.append(sett)
    if valid == True:
        vastaus += 1

text = list(str(input()))
arvo = len(text)
listt = [arvo - 1, 1]

check_group(listt)

next1(listt)

copy = listt.copy()

while True:
    algorithm(listt)
    listt = copy.copy()
    next1(listt)
    copy = listt.copy()
    if listt[0] == 0:
        break

print(vastaus % (10**9 - 7))

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
a

correct output
1

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 51, in <module>
    next1(...

Test 2

Group: 1, 2, 3

Verdict:

input
abcdefghij

correct output
512

user output
511

Test 3

Group: 1, 2, 3

Verdict: ACCEPTED

input
abcabaacbc

correct output
120

user output
120

Test 4

Group: 1, 2, 3

Verdict: ACCEPTED

input
aaxxxxxxaa

correct output
4

user output
4

Test 5

Group: 2, 3

Verdict:

input
mfyzvoxmppoxcvktmcjkryyocfweub...

correct output
643221148

user output
(empty)

Test 6

Group: 3

Verdict:

input
weinscqmmpgbrlboocvtbptgbahmwv...

correct output
831644159

user output
(empty)

Test 7

Group: 3

Verdict:

input
sxaoxcyrjoeieyinaqxwukgzdnhhsw...

correct output
816016015

user output
(empty)