QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#502579#3259. Substring CharactersyundaehyuckAC ✓513ms10576kbPython3924b2024-08-03 09:52:292024-08-03 09:52:29

Judging History

你现在查看的是最新测评结果

  • [2024-08-03 09:52:29]
  • 评测
  • 测评结果:AC
  • 用时:513ms
  • 内存:10576kb
  • [2024-08-03 09:52:29]
  • 提交

answer

from sys import stdin

while 1:

        s = stdin.readline().rstrip()
        
        if s == '':
            break

        p = set(s)
        
        X = set()

        n = len(s)

        min_v = len(s)+10

        for i in range(n):
            
            for j in range(i,n):
                
                if i == 0 and j >= n-1:
                    
                    continue

                t = s[i:j+1]

                if set(t) == p:
                    
                    f = True

                    for k in range(1,len(t)):
                        
                        A = set(t[k:])
                        B = set(t[:k])

                        if A == p or B == p:
                            
                            f = False
                    
                    if f:

                        X.add(t)
        
        print(len(X))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 9ms
memory: 10492kb

input:

aabbabb
abAB34aB3ba7
104001144
aaabcaaa
a
bb
bd
1234567

output:

2
1
3
2
0
1
0
0

result:

ok 8 lines

Test #2:

score: 0
Accepted
time: 121ms
memory: 10456kb

input:

kejfASKDNF2342389fjsl2lsklsdflkjdKDFJKFD2342359829jdkjfkdklsjekfw234234234235123
11111111111111111111111111111111111111111111111111111111111111111111111111111111
12312343123123142312341234123412341234123423412312341234123232312341232341234123

output:

1
1
11

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 218ms
memory: 10576kb

input:

1234543212345432123454321234543212345432123454321234543212345432123454321
1234543212345432123454321234543212345432123454321234543212345432123454321Z
a1234543212345432123454321234543212345432123454321234543212345432123454321
ABCDEFABCDEFABCDEFABCDEFABCDEFABCDEFABCDEFABCDEFABCDEFABCDEFABCDEFABCDEFABCD...

output:

2
1
1
6
1
1
25
2
1
1
1
0
0
1
1
4
5
2
1
1
1
1

result:

ok 22 lines

Test #4:

score: 0
Accepted
time: 513ms
memory: 10456kb

input:

0123456789ABCDEFEDCBA9876543210123456789ABCDEFEDCBA98765432123456789ABCDEFEDCBA
abcdeadbedcacdebadecbdaecdbacebdcaebecadebacebdabecdcbeabedcebdadbcecbdaedbcacb
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZzyxwvutsrqponmlkjihgfedcbaqdKYJt2iHEL3vWFghr
99RBKQEBTBCA8WRSVNBSCGVZFLPTP7F29965694YAKW3B77CCFXCNEWRRL8...

output:

2
32
1
2
1
2
2
1
2
1
1
8
7
8
13
1
6
3
2
1
1
1

result:

ok 22 lines

Test #5:

score: 0
Accepted
time: 118ms
memory: 10484kb

input:

x
dddddddgggggg
dgdgdgdgdgdg
ef1ef1e
ef1ef1
abcbacbacab
cabcbacbacabc
kadksfkaddkdfakkjdfjdfasjdafhgdafsdasflalsdlkhdfhdasjklsadkjdafhklsajfghdasjkdg
1234567890
1234567890987654321
ssss
aba
ec26hb6a4l2wv3rm1ut7r9nxtejs5riidbxenodgipyjjuxtdwi3bykyhnauvv5gvws8r7fxdady7ek8
q3g12voqn3mewezr1jfoejpgh4vc4...

output:

0
1
2
3
3
5
5
6
0
2
1
2
1
1
1
1
1
1
1
7
4
1

result:

ok 22 lines