62802023-11-12 13:07:37HadaGergelyForgó rulettkerékpython3Wrong answer 0/1001.583s30720 KiB
t = input()

n = int(t.split(" ")[0]) # num of lines
m = int(t.split(" ")[1]) # length of lines

all = []

for x in range(n):
    all.append([*input()])


types = []
type_counter = []



for x in range(n):

    temp_type_counter = type_counter.copy()

    for y in range(len(types)):

        if all[x].copy().sort() != types[y].copy().sort(): continue
        else:
            temp = all[x].copy()

            for z in range(m):
                if temp == types[y]:
                    type_counter[y] = type_counter[y] + 1
                    break
                temp.append(temp[0])
                temp.pop(0)
                
            
    if temp_type_counter == type_counter:
        types.append(all[x])
        type_counter.append(1)

print(types, type_counter)

answer = 0

for l in range(len(type_counter)):
    answer = answer + ((type_counter[l]*(type_counter[l]-1))/2)

print(int(answer))
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer17ms11140 KiB
2Wrong answer17ms11248 KiB
subtask20/20
3Wrong answer18ms11524 KiB
4Wrong answer18ms12124 KiB
5Wrong answer32ms12184 KiB
6Wrong answer89ms12408 KiB
7Wrong answer256ms13076 KiB
8Wrong answer86ms12768 KiB
9Wrong answer115ms12728 KiB
subtask30/15
10Time limit exceeded1.564s7920 KiB
11Time limit exceeded1.57s8840 KiB
12Time limit exceeded1.559s8572 KiB
13Time limit exceeded1.57s8260 KiB
14Time limit exceeded1.539s8976 KiB
15Time limit exceeded1.55s9316 KiB
16Time limit exceeded1.564s9664 KiB
17Time limit exceeded1.567s9608 KiB
subtask40/65
18Time limit exceeded1.583s13960 KiB
19Time limit exceeded1.575s13708 KiB
20Time limit exceeded1.578s13904 KiB
21Time limit exceeded1.572s14580 KiB
22Time limit exceeded1.555s14552 KiB
23Time limit exceeded1.536s13720 KiB
24Time limit exceeded1.58s14060 KiB
25Time limit exceeded1.555s15196 KiB
26Time limit exceeded1.57s30568 KiB
27Time limit exceeded1.58s16184 KiB
28Time limit exceeded1.575s17816 KiB
29Time limit exceeded1.565s30592 KiB
30Time limit exceeded1.549s30720 KiB