We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <bits/stdc++.h> using namespace std; map<int,vector<int> >mp; map<int,bool>shown; bool isvalid(vector <int> box){ for(int i=0;i<box.size();i++){ for(int j=0;i<mp[box[i]].size();j++) if(shown[mp[box[i]][j]])return false; }return true; } int main(int argc, char **argv) { int n,m; scanf("%d %d",&n,&m); for(int i=0;i<n;i++){ int a,b; scanf("%d %d",&a,&b); mp[a].push_back(b); mp[b].push_back(a); } for(int i=0;i<m;i++){ int t; cin>>t; vector<int > box; shown.clear();// while(t--){ int b; cin>>b; box.push_back(b); shown[b]=true; } if(isvalid(box))printf("Yes\n"); else printf("No\n"); } return 0; }
The text was updated successfully, but these errors were encountered:
不好意思,我对c++的map等标准库函数不很熟悉,不能确定你的代码在哪里有问题。 另外,不知道这里是误改还是什么:
for(int j=0;i<mp[box[i]].size();j++)
循环控制应该是对j的判断吧。
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: