标签:pre str mes nbsp set push pac mat iostream
感觉又学到了。。。
1 #include <iostream> 2 #include <stdlib.h> 3 #include <string> 4 #include<algorithm> 5 #include<vector> 6 #include<cmath> 7 #include<map> 8 #include<set> 9 #include <unordered_map> 10 using namespace std; 11 12 int main(){ 13 static vector<int> m1[100000]; 14 15 int n, m; 16 cin >> n >> m; 17 for (int i = 0; i < n; i++) { 18 int t1, t2; 19 cin >> t1 >> t2; 20 m1[t1].push_back(t2); 21 m1[t2].push_back(t1); 22 } 23 24 for (int i = 0; i < m; i++) { 25 int num; 26 cin >> num; 27 int list[1001]; 28 for (int j = 0; j < num; j++) { 29 cin >> list[j]; 30 } 31 bool f = 0; 32 for (int j = 0; j < num; j++) { 33 for (int k = j; k < num; k++) { 34 if (find(m1[list[j]].begin(), m1[list[j]].end(), list[k]) != m1[list[j]].end()) { 35 f = 1; 36 } 37 } 38 } 39 if (f == 0) { 40 cout << "Yes" << endl; 41 } 42 else { 43 cout << "No" << endl; 44 } 45 } 46 47 system("pause"); 48 };
1149 Dangerous Goods Packaging
标签:pre str mes nbsp set push pac mat iostream
原文地址:https://www.cnblogs.com/wsggb123/p/10225999.html