标签:int == i++ stream cto bool name space ios
稍微做一点点手脚就不会超时了。。。还是挺简单的,考试时候也做出来了。。。
#include<iostream> #include<string> #include<queue> #include<algorithm> using namespace std; const int inf = 99999999; int main() { int v, e; cin >> v >> e; int check[10001]; vector<int> m1[10001]; for (int i = 0; i < e; i++) { int n1, n2; cin >> n1 >> n2; m1[n1].push_back(i); m1[n2].push_back(i); } int num; cin >> num; for (int i = 0; i < num; i++) { fill(check, check + 10001, 0); int n; cin >> n; for (int j = 0; j < n; j++) { int k; cin >> k; for (int p = 0; p < m1[k].size(); p++) { check[m1[k][p]] = 1; } } bool f = 1; for (int q = 0; q < e; q++) { if (check[q] == 0) { f = 0; break; } } if (f == 0) { cout << "No" << endl; } else { cout << "Yes" << endl; } } system("pause"); }
标签:int == i++ stream cto bool name space ios
原文地址:http://www.cnblogs.com/wsggb123/p/7560181.html