Task: | Anagrams |
Sender: | suchoale |
Submission time: | 2020-09-26 14:04:19 +0300 |
Language: | Python3 (PyPy3) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.55 s | details |
#2 | WRONG ANSWER | 2.68 s | details |
#3 | WRONG ANSWER | 0.89 s | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | WRONG ANSWER | 1.11 s | details |
#6 | WRONG ANSWER | 1.10 s | details |
#7 | WRONG ANSWER | 0.05 s | details |
#8 | WRONG ANSWER | 0.05 s | details |
#9 | WRONG ANSWER | 0.05 s | details |
Code
import sys if __name__ == '__main__': n = int(sys.stdin.readline()) origin_words = list() sorted_words = list() index = list() for i in range(n): word = sys.stdin.readline().strip() origin_words.append(word) sorted_words.append(''.join(sorted(word))) index.append(i) sorted_sorted_words, index = zip(*sorted(zip(sorted_words, index))) anagram_group = dict() for i, word in enumerate(sorted_sorted_words): if word in anagram_group: anagram_group[word].append(origin_words[index[i]]) else: anagram_group[word] = list() anagram_group[word].append(origin_words[index[i]]) for values in anagram_group.values(): print(len(values)) for word in values: print(word)
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
68760 aakkonen aakkosellinen aakkosellisesti aakkosellisuus ... |
correct output |
---|
3076 2 haaraantua raahaantua 2 ... |
user output |
---|
1 takaaladattava 1 tasavaltalaisarmeija 1 ... Truncated |
Test 2
Verdict: WRONG ANSWER
input |
---|
370099 a aa aaa aah ... |
correct output |
---|
30178 2 basiparachromatin marsipobranchiata 2 ... |
user output |
---|
1 a 1 aa 1 ... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
100000 cnhmuewgnum dxkmhzhetnmxadtcy hfjqwavsiguwpludsketibe xwxolrmvkz ... |
correct output |
---|
0 |
user output |
---|
1 a 1 aa 1 ... Truncated |
Test 4
Verdict: TIME LIMIT EXCEEDED
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 |
---|
1 a |
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 |
---|
1 aa 1 ab |