请问一下楼主.第四题我用的是unordered_map来找是否重复,不知道为什么0case,样例数据自测能过,不知道为什么,代码贴上,请楼主帮忙看下: void solution4(){ int T; cin>>T; vector<string> res; while(T--){ int n; cin>>n; unordered_set<string> S; bool same = false; while(n--){ vector<int> circle(6); for(int i=0;i<6;i++){ char c; cin>>c; circle[i] = c; } sort(circle.begin(),circle.end()); string circle_s; for(auto &item:circle){ circle_s += to_string(item); } if(S.find(circle_s)!=S.end()){ same = true; res.emplace_back("YES"); break; } else S.insert(circle_s); } if(!same) res.emplace_back("NO"); } for(auto &s:res) cout<<s<<endl; }
点赞 3

相关推荐

09-10 14:27
中南大学 营销
在提需求的安德鲁很无...:阿q,对面只会觉得好笑
点赞 评论 收藏
分享
09-02 14:53
... 前端工程师
双尔:露头就秒,骗你的,不露也秒
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务