Check Strict Superset

Sort by

recency

|

1162 Discussions

|

  • + 0 comments
    A= set(map(int, input().split()))
    N= int(input())
    
    sets_superset = []
    
    for i in range(N):
        sets= set(map(int, input().split()))
        if len(sets.difference(A)) == 0:
            sets_superset.append(True)
        else:
            sets_superset.append(False)
    
    print(all(sets_superset))
    
  • + 0 comments

    Read the main set A

    A = set(map(int, input().split()))

    Read number of other sets

    n = int(input())

    Assume A is a strict superset of all sets until proven otherwise

    is_strict_superset = True

    for _ in range(n): other_set = set(map(int, input().split()))

    # Check if A is a strict superset of other_set
    if not (A > other_set):  # ">" checks for strict superset
        is_strict_superset = False
        break
    

    Print the final result

    print(is_strict_superset)

  • + 0 comments

    A=set(input().split()) n=int(input()) t=0 f=0 for i in range(n): N=set(input().split()) if A.issuperset(N): t=t+1 else: f=f+1 if f!=0: print('False') else: print('True')

  • + 0 comments

    a=set(map(int,input().split())) n=int(input()) s1=set(map(int,input().split())) s2=set(map(int,input().split()))

    if (a.intersection(s1)== s1 and len(a.difference(s1))>0) and (a.intersection(s2)== s2 and len(a.difference(s2))>0): print(True) else: print(False)

  • + 0 comments

    A = set(map(int, input().split())) for _ in range(int(input())): if not A>(set(map(int, input().split()))): print(False) break else: print(True)