結果
問題 | No.24 数当てゲーム |
ユーザー |
|
提出日時 | 2017-10-29 21:41:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 1,208 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-11-22 05:36:05 |
合計ジャッジ時間 | 1,329 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
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()