6279 | 2023-11-12 12:32:49 | HadaGergely | Forgó rulettkerék | python3 | Runtime error 0/100 | 21ms | 14560 KiB |
n = int(input()) # num of lines
m = int(input()) # length of lines
all = []
for x in range(n):
all.append(input().split(""))
types = []
type_counter = []
types[0]=all[0]
type_counter[0] = 1
for x in range(n):
temp_type_counter = type_counter
for y in range(len(types)):
if all[x].sort() != types[y].sort(): continue
else:
temp = all[x]
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(answer)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Runtime error | 17ms | 11184 KiB | ||||
2 | Runtime error | 18ms | 11228 KiB | ||||
subtask2 | 0/20 | ||||||
3 | Runtime error | 18ms | 11512 KiB | ||||
4 | Runtime error | 18ms | 11760 KiB | ||||
5 | Runtime error | 18ms | 11772 KiB | ||||
6 | Runtime error | 17ms | 12088 KiB | ||||
7 | Runtime error | 18ms | 12496 KiB | ||||
8 | Runtime error | 18ms | 12468 KiB | ||||
9 | Runtime error | 18ms | 12668 KiB | ||||
subtask3 | 0/15 | ||||||
10 | Runtime error | 17ms | 12560 KiB | ||||
11 | Runtime error | 17ms | 12808 KiB | ||||
12 | Runtime error | 17ms | 12984 KiB | ||||
13 | Runtime error | 17ms | 13044 KiB | ||||
14 | Runtime error | 18ms | 12816 KiB | ||||
15 | Runtime error | 19ms | 13044 KiB | ||||
16 | Runtime error | 19ms | 13036 KiB | ||||
17 | Runtime error | 17ms | 13124 KiB | ||||
subtask4 | 0/65 | ||||||
18 | Runtime error | 18ms | 13288 KiB | ||||
19 | Runtime error | 21ms | 13480 KiB | ||||
20 | Runtime error | 18ms | 13568 KiB | ||||
21 | Runtime error | 18ms | 13516 KiB | ||||
22 | Runtime error | 18ms | 13712 KiB | ||||
23 | Runtime error | 17ms | 13844 KiB | ||||
24 | Runtime error | 17ms | 13984 KiB | ||||
25 | Runtime error | 18ms | 13724 KiB | ||||
26 | Runtime error | 17ms | 13940 KiB | ||||
27 | Runtime error | 17ms | 14148 KiB | ||||
28 | Runtime error | 17ms | 14292 KiB | ||||
29 | Runtime error | 17ms | 14464 KiB | ||||
30 | Runtime error | 17ms | 14560 KiB |