Check Strict Superset

Sort by

recency

|

1172 Discussions

|

  • + 0 comments
    set_A = set(map(int,input().split()))
    n = int(input())
    res = []
    for _ in range(n):
        set_B = set(map(int,input().split()))
        flag = set_A.issuperset(set_B)
        res.append(flag)
    print(all(res))
        
    
  • + 0 comments
    A = set(map(int, input().split()))
    n = int(input())
    res = True
    for _ in range(n):
        B = set(map(int, input().split()))
        if not (A.issuperset(B) and A != B):
            res = False
            break
    print(res)
    
  • + 0 comments

    set_A = set(map(int,input().split())) n_numbers = int(input()) flages = True for _ in range(n_numbers): set_n = set(map(int,input().split()))

    if not set_A > set_n:
        flages = False
    

    print(flages)

  • + 0 comments

    Here's my solution that does not require an additional data structure to track the results of each comparison. This may be preferable when you do not want the additional memory overhead as well as the additional loop over the results. This also ends the main loop faster as it can exit as soon as any False is found.

    s = set(map(int,input().split()))
    n = int(input())
    allsupersets = True
    for _ in range(n):
    
        s1 = set(map(int,input().split()))
        if not s.issuperset(s1):
            allsupersets = False
            break
    print(allsupersets) 
    
  • + 0 comments
    A=set(input().split())
    n=int(input())
    temp = []
    for i in range(n):
        B=set(input().split())
        if (A.issuperset(B)):
            temp.append("True")
        else:
            temp.append("False")
    if "False" in temp:
        print("False")
    else:
        print("True")