Task: | Anagrams |
Sender: | m-x-doctor |
Submission time: | 2020-09-26 13:10:26 +0300 |
Language: | Python3 (PyPy3) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.32 s | details |
#2 | WRONG ANSWER | 1.07 s | details |
#3 | WRONG ANSWER | 0.43 s | details |
#4 | WRONG ANSWER | 1.06 s | details |
#5 | WRONG ANSWER | 1.11 s | details |
#6 | WRONG ANSWER | 1.09 s | details |
#7 | WRONG ANSWER | 0.05 s | details |
#8 | WRONG ANSWER | 0.05 s | details |
#9 | WRONG ANSWER | 0.05 s | details |
Code
from collections import defaultdict def hash_word(word): word = ''.join(sorted(word)) return hash(word) def find_anagrams(words): groups = defaultdict(list) for word in words: groups[hash_word(word)].append(word) for _, group_words in groups.items(): size = len(group_words) if size < 2: continue print(size) for word in group_words: print(word) n = int(input()) words = [] for _ in range(n): words.append(input()) find_anagrams(words)
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
68760 aakkonen aakkosellinen aakkosellisesti aakkosellisuus ... |
correct output |
---|
3076 2 haaraantua raahaantua 2 ... |
user output |
---|
2 aakkosellinen kaaoksellinen 2 aallotus ... Truncated |
Test 2
Verdict: WRONG ANSWER
input |
---|
370099 a aa aaa aah ... |
correct output |
---|
30178 2 basiparachromatin marsipobranchiata 2 ... |
user output |
---|
2 aah aha 2 aahed ... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
100000 cnhmuewgnum dxkmhzhetnmxadtcy hfjqwavsiguwpludsketibe xwxolrmvkz ... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 4
Verdict: WRONG ANSWER
input |
---|
400000 vlcsa eltwde wdcwwkubs tmuxbirj ... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 5
Verdict: WRONG ANSWER
input |
---|
400000 ebhfigdacjlk aecfdijlhkgb jfekhbidacgl cehajbidfklg ... |
correct output |
---|
1 400000 abcdeighjlfk abcdeiglhfjk abcdfkilejgh ... |
user output |
---|
400000 ebhfigdacjlk aecfdijlhkgb jfekhbidacgl cehajbidfklg ... Truncated |
Test 6
Verdict: WRONG ANSWER
input |
---|
400000 cbaabghadefb hbbgfaeabdac abaedcbgfbha hcfadbbbeaag ... |
correct output |
---|
1 400000 aaabbbcfegdh aaabbbcfghed aaabbbdcgfhe ... |
user output |
---|
400000 cbaabghadefb hbbgfaeabdac abaedcbgfbha hcfadbbbeaag ... Truncated |
Test 7
Verdict: WRONG ANSWER
input |
---|
1 a |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 8
Verdict: WRONG ANSWER
input |
---|
2 ab ba |
correct output |
---|
1 2 ab ba |
user output |
---|
2 ab ba |
Test 9
Verdict: WRONG ANSWER
input |
---|
2 aa ab |
correct output |
---|
0 |
user output |
---|
(empty) |