Submission #55816666


Source Code Expand

from more_itertools import distinct_permutations
N,K = map(int,input().split())
S = input()
ans = 0
for S in distinct_permutations(S):
    for i in range(N-K+1):
        for j in range(K):
            if S[i+j] != S[i+K-j-1]:
                break
        else:
            break
    else:
        ans += 1
print(ans)

Submission Info

Submission Time
Task C - Avoid K Palindrome 2
User kemuniku
Language Python (PyPy 3.10-v7.3.12)
Score 300
Code Size 330 Byte
Status AC
Exec Time 717 ms
Memory 93948 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 38
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt
Case Name Status Exec Time Memory
example_00.txt AC 138 ms 90056 KiB
example_01.txt AC 137 ms 89612 KiB
example_02.txt AC 258 ms 92208 KiB
hand_00.txt AC 137 ms 89776 KiB
hand_01.txt AC 137 ms 89816 KiB
hand_02.txt AC 717 ms 92180 KiB
hand_03.txt AC 593 ms 91632 KiB
hand_04.txt AC 138 ms 89972 KiB
hand_05.txt AC 243 ms 93948 KiB
hand_06.txt AC 241 ms 93856 KiB
random_00.txt AC 138 ms 89944 KiB
random_01.txt AC 138 ms 89804 KiB
random_02.txt AC 138 ms 89980 KiB
random_03.txt AC 137 ms 89736 KiB
random_04.txt AC 137 ms 89764 KiB
random_05.txt AC 140 ms 90248 KiB
random_06.txt AC 159 ms 91204 KiB
random_07.txt AC 151 ms 90792 KiB
random_08.txt AC 160 ms 91916 KiB
random_09.txt AC 183 ms 92464 KiB
random_10.txt AC 158 ms 91392 KiB
random_11.txt AC 229 ms 93380 KiB
random_12.txt AC 180 ms 92240 KiB
random_13.txt AC 186 ms 92508 KiB
random_14.txt AC 359 ms 92524 KiB
random_15.txt AC 206 ms 92720 KiB
random_16.txt AC 279 ms 93580 KiB
random_17.txt AC 361 ms 92756 KiB
random_18.txt AC 137 ms 89748 KiB
random_19.txt AC 137 ms 89844 KiB
random_20.txt AC 139 ms 89896 KiB
random_21.txt AC 139 ms 89796 KiB
random_22.txt AC 154 ms 91096 KiB
random_23.txt AC 165 ms 91780 KiB
random_24.txt AC 167 ms 91832 KiB
random_25.txt AC 166 ms 91948 KiB
random_26.txt AC 201 ms 92852 KiB
random_27.txt AC 200 ms 92708 KiB