Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Array Subset of another array
#include <bits/stdc++.h> using namespace std; int main() { //code int t; cin>>t; while(t--) { int n1,n2; cin>>n1>>n2; vector<int>v1(n1); vector<int>v2(n2); unordered_set<int>s; for(int i=0;i<n1;i++) { cin>>v1[i]; s.insert(v1[i]); } int f=0;int si=0; for(int i=0;i<n2;i++) { cin>>v2[i]; if(s.find(v2[i])!=s.end()) { si++; } else if(s.find(v2[i])==s.end()) { f++; } } if(f!=0 && si<n2) { cout<<"No"<<endl; } else { cout<<"Yes"<<endl; } } return 0; }
run
|
edit
|
history
|
help
0
blad-z-obcinaniem-koncowek
RegexMatch
Top view of a Binary tree
hh
Arithmetic
TypeSizeTest
aa
Namespace
LRU - DLL
Policy based smart pointer