結果

問題 No.2121 帰属関係と充足可能性
ユーザー gew1fw
提出日時 2025-06-12 21:26:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,825 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 54,492 KB
最終ジャッジ日時 2025-06-12 21:28:03
合計ジャッジ時間 3,277 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    idx = 0
    N = int(input[idx])
    idx += 1
    A = list(map(int, input[idx:idx+6]))
    A = A[:6]  # Ensure we have exactly 6 elements

    if N == 0 or N == 1:
        print("NO")
        return

    elif N == 2:
        # V_2 has two elements: frozenset() and frozenset({frozenset()})
        v0 = frozenset()
        v1 = frozenset({frozenset()})
        V = [v0, v1]

        for m0 in V:
            for m1 in V:
                for m2 in V:
                    a0 = A[0]
                    a1 = A[1]
                    a2 = A[2]
                    a3 = A[3]
                    a4 = A[4]
                    a5 = A[5]

                    # Get the corresponding m variables
                    m_A0 = [m0, m1, m2][a0]
                    m_A1 = [m0, m1, m2][a1]
                    m_A2 = [m0, m1, m2][a2]
                    m_A3 = [m0, m1, m2][a3]
                    m_A4 = [m0, m1, m2][a4]
                    m_A5 = [m0, m1, m2][a5]

                    # Condition C0: m_A0 is subset of m_A1
                    c0 = True
                    for x in m_A0:
                        if x not in m_A1:
                            c0 = False
                            break

                    # Condition C1: m_A1 in m_A2
                    c1 = m_A1 in m_A2

                    # Condition C2: m_A3 in m_A2
                    c2 = m_A3 in m_A2

                    # Condition C3: m_A4 in m_A2
                    c3 = m_A4 in m_A2

                    # Condition C4: m_A5 in m_A0
                    c4 = m_A5 in m_A0

                    if c0 and c1 and c2 and c3 and c4:
                        print("YES")
                        return

        print("NO")

    else:
        print("YES")

if __name__ == "__main__":
    main()
0