-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcheckSubset.py
112 lines (111 loc) · 1.54 KB
/
checkSubset.py
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
__author__ = 'Sanjay'
#
# You are given two sets, A
# A
# and B
# B
# .
# Your job is to find whether set A
# A
# is a subset of set B
# B
# .
#
# If set A
# A
# is subset of set B
# B
# , print True.
# If set A
# A
# is not a subset of set B
# B
# , print False.
#
#
# Input Format
#
#
# The first line will contain the number of test cases, T
# T
# .
# The first line of each test case contains the number of elements in set A
# A
# .
# The second line of each test case contains the space separated elements of set A
# A
# .
# The third line of each test case contains the number of elements in set B
# B
# .
# The fourth line of each test case contains the space separated elements of set B
# B
# .
#
#
# Constraints
#
# 0<T<21
# 0<T<21
#
# 0<Number of elements in each set<1001
# 0<Number of elements in each set<1001
#
#
# Output Format
#
#
# Output True or False for each test case on separate lines.
#
#
# Sample Input
#
# 3
# 5
# 1 2 3 5 6
# 9
# 9 8 5 6 3 2 1 4 7
# 1
# 2
# 5
# 3 6 5 4 1
# 7
# 1 2 3 5 6 8 9
# 3
# 9 8 2
#
#
#
# Sample Output
#
# True
# False
# False
#
#
#
# Explanation
#
#
# Test Case 01 Explanation
#
# Set A
# A
# = {1 2 3 5 6}
# Set B
# B
# = {9 8 5 6 3 2 1 4 7}
# All the elements of set A
# A
# are elements of set B
# B
# .
# Hence, set A
# A
# is a subset of set B
# B
# .
for i in range(int(raw_input())): #More than 4 lines will result in 0 score. Blank lines won't be counted.
a = int(raw_input()); A = set(raw_input().split())
b = int(raw_input()); B = set(raw_input().split())
print not bool(A.difference(B))