Skip to content

Commit

Permalink
Create Assignment_3problem1.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
sanibalakrishna authored Jul 4, 2021
1 parent f6bb93a commit 3548afb
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Assignment_3problem1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <bits/stdc++.h>
using namespace std;
bool isSubset(int m,int n,int arr1[],int arr2[])
{
set<int> s;
for(int i=0;i<m;i++)
{
s.insert(arr1[i]);
}
for(int i=0;i<n;i++)
{
if(s.find(arr2[i])==s.end())
{
return false;
}
}
return true;
}

int main() {
int t,m,n;
cin>>t;
while(t--)
{
cin>>m>>n;
int arr1[m],arr2[n];
for(int i=0;i<m;i++)
{
cin>>arr1[i];
}
for(int i=0;i<n;i++)
{
cin>>arr2[i];
}
if(isSubset(m,n,arr1,arr2))
{
cout<<"Yes"<<endl;
}
else
cout<<"No"<<endl;
}
return 0;

}

0 comments on commit 3548afb

Please sign in to comment.