Task: | Ositus |
Sender: | masuman |
Submission time: | 2021-10-10 15:26:55 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.02 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.02 s | 1, 2, 3 | details |
#3 | WRONG ANSWER | 0.02 s | 1, 2, 3 | details |
#4 | WRONG ANSWER | 0.02 s | 1, 2, 3 | details |
#5 | WRONG ANSWER | 0.03 s | 2, 3 | details |
#6 | WRONG ANSWER | 0.02 s | 3 | details |
#7 | WRONG ANSWER | 0.02 s | 3 | details |
Code
def gS(k):#k is a list of strings that are going to be combined to new strings s = "" for i in k: s += i result = [""] g = 0 for i in s: if i not in result[g]: result[g] += str(i) else: result.append("") g += 1 result[g] += str(i) return result def bS(k): #only when situation like kabba occurs, kab ba --> ka b ba --> k ab ba -bS-> k a b ba --> k a b b a return [k[:-1], k[-1]] #returns a list def dS(s,t): #transfers the last char of left string to right return [s[:-1], s[-1]+t] def case1(lista, iS): x = dS(lista[-(iS+1)], lista[-iS]) lista[-(iS+1)] = x[0] lista[-iS] = x[1] return lista def case2(lista, iS): x = [lista[-(iS+1)][-1]] x += lista[-(iS):] x = gS(x) del lista[-(iS):] lista[-1] = lista[-1][:-1] #removing the last character lista += x return lista def case3(lista, iS): #we go back the elements in lista until we find an element that is NOT singular d = 1 #the amount of steps we need to go back until we find an element that is not singular while len(lista[-(iS+d)]) == 1: d += 1 x = [lista[-(iS+d)][-1]] x += lista[-(iS+d-1):] x = gS(x) del lista[-(iS+d-1):] print(lista, iS, d) lista[-1] = lista[-1][:-1] lista += x return lista def getIs(lista): for iS in range(1,len(lista)+1): if iS == len(lista): return iS if lista[-(iS+1)][-1] not in lista[-iS]: return iS def tails(lista, iS): pii = 1 for i in range(1, iS+1): pii *= pow(2, len(lista[-(i)])-1) return pii def calc(n, s): lista = gS(s) print(lista) if len(lista) == 1: return pow(2, len(lista)-1) summa = pow(2, len(lista[-1])) iS = 1 #how many "tails" do we have, e.g. ka k ka --> 2 tails "k" and "ka", we only manipulate the left-most tail, thats why we keep count of while len(lista) > iS: #DOES NOT TAKE INTO CONSIDERATION WHETHER THE LIST IS ACTUALLY JUST 1 CHAR LONG!!! HAS TO BE DONE IN A RATHER DIRTY WAY #possibility 1: we can expand the last element of the list, i.e. the second last element's last element is not in the last element AND the second last element is not singular if lista[-(iS+1)][-1] not in lista[-iS] and len(lista[-(iS+1)]) != 1: lista = case1(lista, iS) print("case1:", lista) #possibility 2: we cannot expand the last element of the list, i.e. the second last element's last element is in the last element AND the second last element is not singular elif lista[-(iS+1)][-1] in lista[-iS] and len(lista[-(iS+1)]) != 1: lista = case2(lista, iS) print("case2:", lista) #possibility 3: we cannot expand the last element of the list, i.e. the second last element's last element is in the last element AND the second last element IS singular elif lista[-(iS+1)][-1] in lista[-iS] and len(lista[-(iS+1)]) == 1: case3(lista, iS) print("case3:", lista) if len(lista[0]) == 1: #remove all the elements from the left that are singular, important for poss. 3 while len(lista[0]) == 1: lista.pop(0) iS = getIs(lista) summa += tails(lista, iS) print(summa) calc(4, ["aybabtu"])
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
a |
correct output |
---|
1 |
user output |
---|
['ayb', 'abtu'] case2: ['ay', 'ba', 'btu'] case1: ['ay', 'b', 'abtu'] case1: ['a', 'yb', ' ... Truncated |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
abcdefghij |
correct output |
---|
512 |
user output |
---|
['ayb', 'abtu'] case2: ['ay', 'ba', 'btu'] case1: ['ay', 'b', 'abtu'] case1: ['a', 'yb', ' ... Truncated |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
abcabaacbc |
correct output |
---|
120 |
user output |
---|
['ayb', 'abtu'] case2: ['ay', 'ba', 'btu'] case1: ['ay', 'b', 'abtu'] case1: ['a', 'yb', ' ... Truncated |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
aaxxxxxxaa |
correct output |
---|
4 |
user output |
---|
['ayb', 'abtu'] case2: ['ay', 'ba', 'btu'] case1: ['ay', 'b', 'abtu'] case1: ['a', 'yb', ' ... Truncated |
Test 5
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
mfyzvoxmppoxcvktmcjkryyocfweub... |
correct output |
---|
643221148 |
user output |
---|
['ayb', 'abtu'] case2: ['ay', 'ba', 'btu'] case1: ['ay', 'b', 'abtu'] case1: ['a', 'yb', ' ... Truncated |
Test 6
Group: 3
Verdict: WRONG ANSWER
input |
---|
weinscqmmpgbrlboocvtbptgbahmwv... |
correct output |
---|
831644159 |
user output |
---|
['ayb', 'abtu'] case2: ['ay', 'ba', 'btu'] case1: ['ay', 'b', 'abtu'] case1: ['a', 'yb', ' ... Truncated |
Test 7
Group: 3
Verdict: WRONG ANSWER
input |
---|
sxaoxcyrjoeieyinaqxwukgzdnhhsw... |
correct output |
---|
816016015 |
user output |
---|
['ayb', 'abtu'] case2: ['ay', 'ba', 'btu'] case1: ['ay', 'b', 'abtu'] case1: ['a', 'yb', ' ... Truncated |