/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 21ms 2.949 MiB
#2 Accepted 453ms 11.836 MiB
#3 Accepted 498ms 11.84 MiB
#4 Accepted 1723ms 5.047 MiB
#5 Time Exceeded ≥2019ms ≥5.039 MiB
#6 Time Exceeded ≥2059ms ≥3.402 MiB

Code

t=int(input())
for x in range(t):
    n=int(input())
    s=input()
    li=list(s)
    se=list(set(s))
    pair=0
    for i in se:
        count=0
        for j in li:
            if i ==j:
                count+=1
        pair+=(count*(count-1))
    print(pair)

Information

Submit By
Type
Submission
Problem
P1038 Do not touch my string
Contest
Brain Booster #3
Language
Python 3 (Python 3.12.3)
Submit At
2024-05-06 16:48:19
Judged At
2024-11-11 03:32:46
Judged By
Score
40
Total Time
≥2059ms
Peak Memory
≥11.84 MiB