P2580于是他错误的点名开始了

一、题目描述

  

 

   

 

 二、解题思路

  这个题的数据量有点大,考虑hash,然后就用了set,(stl大法好)

三、代码实现

复制代码
 1 #include "bits/stdc++.h"
 2 using namespace std;
 3 set <string> ans;
 4 set <string> ans2;
 5 string temp;
 6 int main()
 7 {
 8     int n,m;
 9     cin >> n;
10     for(int i = 1;i <= n;i++){
11         cin >> temp;
12         ans.insert(temp);
13     }
14     cin >> m;
15     for(int i = 1;i <= m;i++) {
16         cin >> temp;
17         if(!ans2.count(temp)) {
18             if(ans.count(temp))
19                 cout << "OK" << endl;
20             else 
21                 cout << "WRONG" << endl;
22             ans2.insert(temp);
23         }
24         else 
25             cout << "REPEAT" << endl;
26     }
27     return 0;
28 }
复制代码
posted @   scannerkk  阅读(31)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
点击右上角即可分享
微信分享提示