結果
問題 |
No.3171 Color Restoration
|
ユーザー |
|
提出日時 | 2025-02-21 01:28:41 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 937 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 82,180 KB |
実行使用メモリ | 67,592 KB |
最終ジャッジ日時 | 2025-06-06 20:50:08 |
合計ジャッジ時間 | 3,291 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 26 |
ソースコード
from more_itertools import distinct_permutations table = [ ["gray","brown","green","cyan","blue","yellow","orange","red"], ["gray","green","blue","yellow","red"], ["gray","green","cyan","blue","violet","orange","red"] ] # 入力を受け取る S = input().split() # ソートする S.sort() # 何通りあるかのカウンター cnt = 0 # 順列全探索 for tmp_S in distinct_permutations(S): # 条件を満たしているかのフラグ is_satisfied = True for i in range(3): # table[i] に該当するサイト内で S[i] に該当する色があるかを調べる if not tmp_S[i] in table[i]: # 該当する色がなかった場合の処理 is_satisfied = False break # すべてのサイトで条件を満たしていた場合カウンタをインクリメント cnt += is_satisfied # 答えを出力 print('Yes' if cnt == 1 else 'No')