結果

問題 No.3171 Color Restoration
ユーザー nikoro256
提出日時 2025-06-06 21:35:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 81,732 KB
実行使用メモリ 53,624 KB
最終ジャッジ日時 2025-06-06 21:35:50
合計ジャッジ時間 2,243 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

s1,s2,s3 = map(str, input().split())
s = [s1,s2,s3]
if len(set(s)) == 1:
    print("Yes")
    exit()
a=[{"gray","brown","green","cyan","blue","yellow","orange","red"},
{"gray","green","blue","yellow","red"},
{"gray","green","cyan","blue","violet","orange","red"}]
while len(a) > 0:
    b = False
    for si in s:
        c = 0
        for ai in a:
            if si in ai:
                c += 1
        if c==1:
            for ai in a:
                if si in ai:
                    s.remove(si)
                    a.remove(ai)
                    break
            b = True
            break
    if not b:
        break
if len(a) == 0 or len(set(s)) == 1:
    print("Yes")
else:
    print("No")
0