結果

問題 No.3171 Color Restoration
ユーザー detteiuu
提出日時 2025-06-06 21:34:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,376 KB
最終ジャッジ日時 2025-06-06 21:34:38
合計ジャッジ時間 2,597 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

S = list(input().split())

A = [["gray","brown","green","cyan","blue","yellow","orange","red"],
    ["gray","green","blue","yellow","red"],
    ["gray","green","cyan","blue","violet","orange","red"]]

cnt = 0
for perm in permutations(range(3)):
    for i in range(3):
        if S[i] not in A[perm[i]]:
            break
    else:
        cnt += 1

if S.count(S[0]) == 3:
    print("Yes" if cnt == 6 else "No")
elif S.count(S[0]) == 2 or S.count(S[1]) == 2:
    print("Yes" if cnt == 2 else "No")
else:
    print("Yes" if cnt == 1 else "No")
0