結果

問題 No.24 数当てゲーム
ユーザー magurogumamaguroguma
提出日時 2017-08-06 21:01:38
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 756 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2023-08-02 03:49:32
合計ジャッジ時間 893 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,788 KB
testcase_01 AC 13 ms
7,880 KB
testcase_02 AC 14 ms
7,788 KB
testcase_03 AC 13 ms
7,848 KB
testcase_04 AC 15 ms
7,908 KB
testcase_05 AC 14 ms
7,788 KB
testcase_06 AC 14 ms
7,936 KB
testcase_07 AC 14 ms
7,792 KB
testcase_08 AC 13 ms
7,932 KB
testcase_09 AC 14 ms
7,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

if __name__ == '__main__':
    N = int(input())
    turn = []
    for i in range(N):
        turn.append(list(input().split()))

    # YESの数字の積集合を取り,NOの数字の和集合を取る
    yes_intersection = {0,1,2,3,4,5,6,7,8,9}
    no_union = set([])
    for i in range(N):
        turn_set = set(list(map(int, turn[i][:4])))
        if turn[i][4] == 'YES':
            yes_intersection = yes_intersection.intersection(turn_set)
        else:
            no_union = no_union.union(turn_set)
    # NOの和集合の排他集合を取る
    ex_no = {0,1,2,3,4,5,6,7,8,9}.difference(no_union)
    # YESの積集合とex_noの積集合で残る要素が答え
    print(yes_intersection.intersection(ex_no).pop())
0