QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#502577#3259. Substring CharactersyundaehyuckAC ✓501ms10568kbPython3891b2024-08-03 09:50:562024-08-03 09:51:00

Judging History

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

  • [2024-08-03 09:51:00]
  • 评测
  • 测评结果:AC
  • 用时:501ms
  • 内存:10568kb
  • [2024-08-03 09:50:56]
  • 提交

answer

while 1:
    
    try:

        s = input()

        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))
    
    except:
        
        break

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 10ms
memory: 10408kb

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: 119ms
memory: 10448kb

input:

kejfASKDNF2342389fjsl2lsklsdflkjdKDFJKFD2342359829jdkjfkdklsjekfw234234234235123
11111111111111111111111111111111111111111111111111111111111111111111111111111111
12312343123123142312341234123412341234123423412312341234123232312341232341234123

output:

1
1
11

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 230ms
memory: 10396kb

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: 501ms
memory: 10512kb

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: 125ms
memory: 10568kb

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