6281 | 2023-11-12 13:29:05 | HadaGergely | Forgó rulettkerék | python3 | Time limit exceeded 20/100 | 1.601s | 30064 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)
answer = 0
for l in range(len(type_counter)):
answer = answer + ((type_counter[l]*(type_counter[l]-1))/2)
print(int(answer))
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11124 KiB | ||||
2 | Accepted | 17ms | 11452 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 18ms | 11652 KiB | ||||
4 | Accepted | 18ms | 11812 KiB | ||||
5 | Accepted | 32ms | 12116 KiB | ||||
6 | Accepted | 82ms | 12052 KiB | ||||
7 | Accepted | 270ms | 12584 KiB | ||||
8 | Accepted | 86ms | 12760 KiB | ||||
9 | Accepted | 119ms | 12800 KiB | ||||
subtask3 | 0/15 | ||||||
10 | Time limit exceeded | 1.57s | 7792 KiB | ||||
11 | Time limit exceeded | 1.562s | 8656 KiB | ||||
12 | Time limit exceeded | 1.582s | 8424 KiB | ||||
13 | Time limit exceeded | 1.57s | 8056 KiB | ||||
14 | Time limit exceeded | 1.57s | 8536 KiB | ||||
15 | Time limit exceeded | 1.578s | 8804 KiB | ||||
16 | Time limit exceeded | 1.578s | 8596 KiB | ||||
17 | Time limit exceeded | 1.539s | 8864 KiB | ||||
subtask4 | 0/65 | ||||||
18 | Time limit exceeded | 1.575s | 13300 KiB | ||||
19 | Time limit exceeded | 1.575s | 12820 KiB | ||||
20 | Time limit exceeded | 1.567s | 13044 KiB | ||||
21 | Time limit exceeded | 1.575s | 13720 KiB | ||||
22 | Time limit exceeded | 1.572s | 14008 KiB | ||||
23 | Time limit exceeded | 1.567s | 13144 KiB | ||||
24 | Time limit exceeded | 1.58s | 13452 KiB | ||||
25 | Time limit exceeded | 1.588s | 14428 KiB | ||||
26 | Time limit exceeded | 1.582s | 29744 KiB | ||||
27 | Time limit exceeded | 1.555s | 15692 KiB | ||||
28 | Time limit exceeded | 1.559s | 16964 KiB | ||||
29 | Time limit exceeded | 1.557s | 29836 KiB | ||||
30 | Time limit exceeded | 1.601s | 30064 KiB |