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 @ 2022-02-08 20:25  scannerkk  阅读(49)  评论(0)    收藏  举报