結果

問題 No.24 数当てゲーム
ユーザー mokraimokrai
提出日時 2017-10-29 21:41:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 1,208 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-05-01 22:23:44
合計ジャッジ時間 1,212 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,624 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,624 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 31 ms
10,624 KB
testcase_09 AC 30 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    yes_list = []
    yes_count = 0
    no_list = []
    no_count = 0
    for i in range(N):
        l = input().split()
        if l[-1] == "YES": 
            yes_count += 1
            for j in range(4):
                yes_list.append(int(l[j]))
        else:
            no_count += 1
            for j in range(4):
                no_list.append(int(l[j]))

    #print("yes_list", yes_list)
    #print("no_list", no_list)

    maybe_yes_from_no_list = []
    for i in range(10):
        if i not in no_list:
            maybe_yes_from_no_list.append(i)

    #print("maybe_yes_from_no_list", maybe_yes_from_no_list)

    maybe_yes_from_yes_list = []
    for i in set(yes_list):
        if yes_list.count(i) == yes_count:
            maybe_yes_from_yes_list.append(i)

    #print("maybe_yes_from_yes_list", maybe_yes_from_yes_list)

    if len(maybe_yes_from_no_list) == 1:
        print(maybe_yes_from_no_list[0])
    elif len(maybe_yes_from_yes_list) == 1:
        print(maybe_yes_from_yes_list[0])
    else:
        intersection = set(maybe_yes_from_yes_list) & set(maybe_yes_from_no_list)
        print(list(intersection)[0])



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