Check Subset

Sort by

recency

|

934 Discussions

|

  • + 0 comments

    For Python3 Platform

    T = int(input())
    
    for _ in range(T):
        Na = int(input())
        A = set(map(int, input().split()))
        Nb = int(input())
        B = set(map(int, input().split()))
        
        print(A.issubset(B))
    
  • + 0 comments

    # Enter your code here. Read input from STDIN. Print output to STDOUT

    t = int(input())

    for _ in range(t): set_a_size = int(input()) set_a = set(map(int,input().split()))

    cand_size = int(input())
    cand_set = set(map(int,input().split()))
    
    print(set_a.issubset(cand_set))
    
  • + 0 comments
    for _ in range(int(input())):
        a=input()
        A=set(map(int,input().split()))
        b=input()
        B=set(map(int,input().split()))
        if A.issubset(B):
            print(True)
        else:
            print(False)
    
  • + 0 comments
    T = int(input())
    for i in range(T):
        ele_A = int(input())
        A = set(map(int, input().split()))
        ele_B = int(input())
        B = set(map(int, input().split()))
    
        comm = list(A.intersection(B))
        flag = False
        if len(comm) == len(A):
            flag = True
            if len(comm) == 0:
                flag = False
            else:
                for digit in comm:
                    if digit not in B:
                        flag = False
                        break
            print(flag)
        else:
            print(flag)
    
  • + 0 comments

    hi