forked from kothariji/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHEFSQ.c
55 lines (46 loc) · 775 Bytes
/
CHEFSQ.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//Author: Rakshit Naidu
#include <stdio.h>
int main(void) {
// your code goes here
int t;
scanf("%d",&t);
while(t--)
{
int n1;
scanf("%d",&n1);
int a[n1];
for(int i=0;i<n1;i++)
{
scanf("%d",&a[i]);
}
int n2;
scanf("%d",&n2);
int b[n2];
for(int i=0;i<n2;i++)
{
scanf("%d",&b[i]);
}
int i,j,f=0;
for(i=0,j=0;i<n1&&j<n2;i++)
{
if(a[i]==b[j])
{
f++;
j++;
if(f==n2)
{
break;
}
}
}
if(f==n2)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
return 0;
}