| Task: | Ruudukko |
| Sender: | ossikoo |
| Submission time: | 2019-10-10 18:05:48 +0300 |
| Language: | Python3 (CPython3) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.02 s | details |
| #2 | WRONG ANSWER | 0.02 s | details |
| #3 | WRONG ANSWER | 0.02 s | details |
| #4 | WRONG ANSWER | 0.02 s | details |
| #5 | WRONG ANSWER | 0.02 s | details |
| #6 | WRONG ANSWER | 0.02 s | details |
Code
params = input().split("\n")
n = int(params[0])
strings = params[1:]
# sort into arrays based on length
harmonic_potential = {}
for string in strings:
str_len = len(string)
if not str_len in harmonic_potential:
harmonic_potential[str_len] = []
harmonic_potential[str_len].append(string)
harmonic_count = 0
harmonics = []
for str_list in harmonic_potential.values():
for index, string in enumerate(str_list):
same_char = [] # [ [pos1, pos2] ]
diff_char = []
for pos, char in enumerate(string):
for other_pos in range(pos + 1, len(string)):
other_char = string[other_pos]
if char == other_char:
same_char.append([pos, other_pos])
else:
diff_char.append([pos, other_pos])
for other_index in range(index + 1, len(str_list)):
other_string = str_list[other_index]
if other_index != index:
is_harmonic = True
for same_char_info in same_char:
pos0 = same_char_info[0]
pos1 = same_char_info[1]
if other_string[pos0] != other_string[pos1]:
is_harmonic = False
break
for diff_char_info in diff_char:
pos0 = diff_char_info[0]
pos1 = diff_char_info[1]
if other_string[pos0] == other_string[pos1]:
is_harmonic = False
break
if is_harmonic:
harmonic_count += 1
harmonics.append((string, other_string))
print(harmonic_count)
#print(harmonics)
# 6 AAB ABKA SSG TSGT ZZZZ KEAK
# 10 AB CD AAB DDS EET QWEE RRTA EIOP PPAB IPAA
# 4Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 0 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 2 |
| correct output |
|---|
| 1 2 2 1 |
| user output |
|---|
| 0 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 5 |
| correct output |
|---|
| 1 2 3 4 5 2 1 4 3 6 3 4 1 2 7 4 3 2 1 8 5 6 7 8 1 |
| user output |
|---|
| 0 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 42 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 0 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 99 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 0 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 0 |
