6284 | 2023-11-12 14:42:48 | HadaGergely | Forgó rulettkerék | python3 | Time limit exceeded 20/100 | 1.585s | 526900 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 all[x] == types[y][z]:
type_counter[y] = type_counter[y] + 1
break
"""
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:
temp = all[x].copy()
temp_2d = []
for p in range(m):
temp_2d.append(temp.copy())
temp.append(temp[0])
temp.pop(0)
types.append(temp_2d.copy())
type_counter.append(1)
"""
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 | 17ms | 11180 KiB | ||||
2 | Accepted | 17ms | 11532 KiB | ||||
subtask2 | 20/20 | ||||||
3 | Accepted | 18ms | 11908 KiB | ||||
4 | Accepted | 18ms | 11964 KiB | ||||
5 | Accepted | 39ms | 13044 KiB | ||||
6 | Accepted | 128ms | 15336 KiB | ||||
7 | Accepted | 430ms | 28200 KiB | ||||
8 | Accepted | 134ms | 15908 KiB | ||||
9 | Accepted | 179ms | 17228 KiB | ||||
subtask3 | 0/15 | ||||||
10 | Time limit exceeded | 1.574s | 51472 KiB | ||||
11 | Time limit exceeded | 1.583s | 65044 KiB | ||||
12 | Time limit exceeded | 1.574s | 139196 KiB | ||||
13 | Time limit exceeded | 1.55s | 65816 KiB | ||||
14 | Time limit exceeded | 1.565s | 57812 KiB | ||||
15 | Time limit exceeded | 1.567s | 163688 KiB | ||||
16 | Time limit exceeded | 1.58s | 175092 KiB | ||||
17 | Time limit exceeded | 1.585s | 172368 KiB | ||||
subtask4 | 0/65 | ||||||
18 | Time limit exceeded | 1.582s | 29288 KiB | ||||
19 | Time limit exceeded | 1.582s | 41184 KiB | ||||
20 | Runtime error | 505ms | 526840 KiB | ||||
21 | Runtime error | 1.292s | 526900 KiB | ||||
22 | Time limit exceeded | 1.574s | 59820 KiB | ||||
23 | Runtime error | 649ms | 526892 KiB | ||||
24 | Time limit exceeded | 1.562s | 81276 KiB | ||||
25 | Runtime error | 528ms | 526664 KiB | ||||
26 | Time limit exceeded | 1.572s | 29880 KiB | ||||
27 | Time limit exceeded | 1.585s | 20980 KiB | ||||
28 | Runtime error | 397ms | 526376 KiB | ||||
29 | Time limit exceeded | 1.565s | 30404 KiB | ||||
30 | Time limit exceeded | 1.58s | 30628 KiB |