Task: | Anagrams |
Sender: | henrikaalto |
Submission time: | 2018-10-20 13:48:42 +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 |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:11:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(size_t i=0;i<n;i++){cin>>a;b=a;sort(a.begin(),a.end());v.push_back({a,b});} ~^~ input/code.cpp:16:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(size_t i=0;i<n;i++){ ~^~ input/code.cpp:21:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(j+i<n){ ~~~^~ input/code.cpp:37:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(size_t j=0;j<res0[i];j++) cout<<res1[i][j]<<"\n";
Code
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); int n; cin>>n; vector<pair<string,string>> v; string a,b; for(size_t i=0;i<n;i++){cin>>a;b=a;sort(a.begin(),a.end());v.push_back({a,b});} sort(v.begin(),v.end()); vector<long long> res0; vector<vector<string>> res1; for(size_t i=0;i<n;i++){ // cout<<i<<"\n"; long long count=0; vector<string> res; size_t j=0;bool ok=0; while(j+i<n){ // cout<<v[i].first<<" "<<v[i+j].first<<"\n"; if(v[i].first==v[j+i].first){res.push_back(v[i+j].second);count++;} else{ok=1;break;} j++; } if(ok) j--; if(count==1) continue; res0.push_back(count); res1.push_back(res); // cout<<"j "<<j<<"\n"; i+=j; } cout<<res0.size()<<"\n"; for(size_t i=0;i<res0.size();i++){ cout<<res0[i]<<"\n"; for(size_t j=0;j<res0[i];j++) cout<<res1[i][j]<<"\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) |