PAT 甲级 1149:Dangerous Goods Packaging (25分)

 WA代码如下:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 map<string, string> mmp;
 4 map<string, int> has;
 5 int main()
 6 {
 7     int n, m; cin >> n >> m; string a, b;
 8     for(int i = 0; i < n; i++){
 9         cin >> a >> b;
10         mmp[a] = b; mmp[b] = a;
11     }
12     vector<string> v;
13     for(int i = 0; i < m; i++) {
14         int u, cnt = 0; cin >> u; v.resize(u);
15         for(int j = 0; j < u; j++) {
16             cin >> v[j]; has[v[j]] = 1;
17             if(has[mmp[v[j]]] == 1) {
18                 cnt = 1;
19             }
20         }
21         v.clear(); has.clear();
22         printf(cnt == 1 ? "No":"Yes"); cout << endl;
23     }
24     return 0;
25 }

 

第一个测试点排查不出,请路过的前辈指正,感谢!

原文地址:https://www.cnblogs.com/kamisamalz/p/13390392.html