Submission details
Task:Anagrams
Sender:niketin
Submission time:2020-09-26 13:39:33 +0300
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#10.26 sdetails
#21.47 sdetails
#30.45 sdetails
#41.66 sdetails
#5ACCEPTED0.68 sdetails
#6ACCEPTED0.67 sdetails
#70.01 sdetails
#8ACCEPTED0.01 sdetails
#90.01 sdetails

Code

#include <iostream>
#include <algorithm>
#include <string>
#include <functional>
#include <bits/stdc++.h>
#define N 1000000
using namespace std;
using llu = long long signed;

map<size_t, vector<string>> m;

int main()
{
    llu n;

    string s;
    
    cin >> n;

    for (llu i = 0;i<n;++i){
        cin >> s;
        string ssorted = s;
        sort(ssorted.begin(), ssorted.end());
        auto asd = hash<string>{}(ssorted);
        
        if (m.find(asd) == m.end()) {
            m[asd] = vector<string>();
        }
        m[asd].push_back(s);
    }

    std::cout << m.size() << endl;

    for (auto const& x : m)
    {
        
        std::cout << x.second.size() << endl;

        for (auto const& y : x.second) {
            std::cout << y << endl;
        }
    }
    return 0;
}

Test details

Test 1

Verdict:

input
68760
aakkonen
aakkosellinen
aakkosellisesti
aakkosellisuus
...

correct output
3076
2
haaraantua
raahaantua
2
...

user output
65166
1
konnanmarja
1
elementaarisuus
...
Truncated

Test 2

Verdict:

input
370099
a
aa
aaa
aah
...

correct output
30178
2
basiparachromatin
marsipobranchiata
2
...

user output
326945
1
shelvings
1
brangler
...
Truncated

Test 3

Verdict:

input
100000
cnhmuewgnum
dxkmhzhetnmxadtcy
hfjqwavsiguwpludsketibe
xwxolrmvkz
...

correct output
0

user output
100000
1
hkzvqvmbvaygnnsjodphfnjizxvqvc
1
hxdrdocoljsf
...
Truncated

Test 4

Verdict:

input
400000
vlcsa
eltwde
wdcwwkubs
tmuxbirj
...

correct output
0

user output
400000
1
cgtnytfrk
1
pzdnfsdnzidc
...
Truncated

Test 5

Verdict: ACCEPTED

input
400000
ebhfigdacjlk
aecfdijlhkgb
jfekhbidacgl
cehajbidfklg
...

correct output
1
400000
abcdeighjlfk
abcdeiglhfjk
abcdfkilejgh
...

user output
1
400000
ebhfigdacjlk
aecfdijlhkgb
jfekhbidacgl
...
Truncated

Test 6

Verdict: ACCEPTED

input
400000
cbaabghadefb
hbbgfaeabdac
abaedcbgfbha
hcfadbbbeaag
...

correct output
1
400000
aaabbbcfegdh
aaabbbcfghed
aaabbbdcgfhe
...

user output
1
400000
cbaabghadefb
hbbgfaeabdac
abaedcbgfbha
...
Truncated

Test 7

Verdict:

input
1
a

correct output
0

user output
1
1
a

Test 8

Verdict: ACCEPTED

input
2
ab
ba

correct output
1
2
ab
ba

user output
1
2
ab
ba

Test 9

Verdict:

input
2
aa
ab

correct output
0

user output
2
1
aa
1
ab