Task: | Anagrams |
Sender: | Pohjantahti |
Submission time: | 2018-10-20 13:09:18 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | UNKNOWN | -- | details |
#2 | UNKNOWN | -- | details |
#3 | UNKNOWN | -- | details |
#4 | UNKNOWN | -- | details |
#5 | UNKNOWN | -- | details |
#6 | UNKNOWN | -- | details |
#7 | UNKNOWN | -- | details |
#8 | UNKNOWN | -- | details |
#9 | UNKNOWN | -- | details |
Code
#include <iostream> #include <string> #include <map> #include <algorithm> #include <vector> using namespace std; int n; map<string, vector<string>> mp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) { string cs; cin >> cs; string ss = cs; sort(ss.begin(), ss.end()); mp[ss].push_back(cs); } vector<string> rk; for (auto a : mp) { if (a.second.size() > 1) { rk.push_back(a.first); } } cout << rk.size() << "\n"; for (auto ck : rk) { vector<string> cv = mp[ck]; cout << cv.size() << "\n"; for (auto cs : cv) { cout << cs << "\n"; } } return 0; }
Test details
Test 1
Verdict: UNKNOWN
input |
---|
68760 aakkonen aakkosellinen aakkosellisesti aakkosellisuus ... |
correct output |
---|
3076 2 haaraantua raahaantua 2 ... |
user output |
---|
(not available) |
Test 2
Verdict: UNKNOWN
input |
---|
370099 a aa aaa aah ... |
correct output |
---|
30178 2 basiparachromatin marsipobranchiata 2 ... |
user output |
---|
(not available) |
Test 3
Verdict: UNKNOWN
input |
---|
100000 cnhmuewgnum dxkmhzhetnmxadtcy hfjqwavsiguwpludsketibe xwxolrmvkz ... |
correct output |
---|
0 |
user output |
---|
(not available) |
Test 4
Verdict: UNKNOWN
input |
---|
400000 vlcsa eltwde wdcwwkubs tmuxbirj ... |
correct output |
---|
0 |
user output |
---|
(not available) |
Test 5
Verdict: UNKNOWN
input |
---|
400000 ebhfigdacjlk aecfdijlhkgb jfekhbidacgl cehajbidfklg ... |
correct output |
---|
1 400000 abcdeighjlfk abcdeiglhfjk abcdfkilejgh ... |
user output |
---|
(not available) |
Test 6
Verdict: UNKNOWN
input |
---|
400000 cbaabghadefb hbbgfaeabdac abaedcbgfbha hcfadbbbeaag ... |
correct output |
---|
1 400000 aaabbbcfegdh aaabbbcfghed aaabbbdcgfhe ... |
user output |
---|
(not available) |
Test 7
Verdict: UNKNOWN
input |
---|
1 a |
correct output |
---|
0 |
user output |
---|
(not available) |
Test 8
Verdict: UNKNOWN
input |
---|
2 ab ba |
correct output |
---|
1 2 ab ba |
user output |
---|
(not available) |
Test 9
Verdict: UNKNOWN
input |
---|
2 aa ab |
correct output |
---|
0 |
user output |
---|
(not available) |