Task: | Ositus |
Sender: | Tipu |
Submission time: | 2021-10-15 14:34:43 +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.02 s | 2, 3 | details |
#6 | WRONG ANSWER | 0.07 s | 3 | details |
#7 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
import time start_time = time.time() def main(): mjono = input() print(osita(mjono) % (1000000000 + 7)) def osita(jono: str): koko = len(jono) poistot = 0 kirjaimet = {"a" : -1,"b" : -1,"c" : -1,"d" :-1,"e" :-1,"f" :-1,"g" : -1,"h" : -1,"i" : -1,"j" : -1,"k" : -1,"l" : -1,"m" : -1,"n" : -1,"o" : -1,"p" : -1,"q" :-1,"r" : -1,"s" : -1,"t" : -1,"u" : -1,"v" : -1,"w" : -1,"x" : -1,"y" : -1,"z" : -1} index = 0 loppu = False välit = 0 for kirjain in jono: väli = 0 loppu = True edellinen = kirjaimet[kirjain] if edellinen >= 0: if välit >= 0: poistot -= (välit) # print("moi") loppu = False väli = koko - (index - edellinen) # print(mahdollisuudet(väli), kirjain) poistot += mahdollisuudet(väli) välit += väli välit -= 1 kirjaimet[kirjain] = index index += 1 # print(välit) if välit >= 0 and loppu or välit == 0: poistot -= (välit + 1) # print("moi") return (mahdollisuudet(koko) - poistot) def mahdollisuudet(n: int): luku = 2**(n - 1)- 1 return luku main() #print("--- %s seconds ---" % (time.time() - start_time))
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
a |
correct output |
---|
1 |
user output |
---|
0 |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
abcdefghij |
correct output |
---|
512 |
user output |
---|
511 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
abcabaacbc |
correct output |
---|
120 |
user output |
---|
999999950 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
aaxxxxxxaa |
correct output |
---|
4 |
user output |
---|
999998934 |
Test 5
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
mfyzvoxmppoxcvktmcjkryyocfweub... |
correct output |
---|
643221148 |
user output |
---|
603944551 |
Test 6
Group: 3
Verdict: WRONG ANSWER
input |
---|
weinscqmmpgbrlboocvtbptgbahmwv... |
correct output |
---|
831644159 |
user output |
---|
945458070 |
Test 7
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
sxaoxcyrjoeieyinaqxwukgzdnhhsw... |
correct output |
---|
816016015 |
user output |
---|
(empty) |