結果
| 問題 |
No.3171 Color Restoration
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-06 22:03:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 1,231 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 82,216 KB |
| 実行使用メモリ | 54,508 KB |
| 最終ジャッジ日時 | 2025-06-14 11:56:28 |
| 合計ジャッジ時間 | 2,179 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
Colors=[]
Colors.append(set(["gray","brown","green","cyan","blue","yellow","orange","red"]))
Colors.append(set(["gray","green","blue","yellow","red"]))
Colors.append(set(["gray","green","cyan","blue","violet","orange","red"]))
S=list(input().split())
cands=[[0,0,0] for _ in range(3)]
for i,s in enumerate(S):
for j,colors in enumerate(Colors):
if s in colors:cands[i][j]+=1
for i in range(3):
if sum(cands[i])==1:
for ii in range(3):
if ii==i:continue
cands[ii][cands[i].index(1)]=0
for j in range(3):
sm=0
ii=-1
for i in range(3):
sm+=cands[i][j]
if cands[i][j]==1:ii=i
if sm==1:
for jj in range(3):
if jj==j:continue
cands[ii][jj]=0
if sum(cands[0])==1 and sum(cands[1])==1 and sum(cands[2])==1:exit(print("Yes"))
if sum(cands[0])==1 and sum(cands[1])==2 and sum(cands[2])==2 and S[1]==S[2]:exit(print("Yes"))
if sum(cands[0])==2 and sum(cands[1])==1 and sum(cands[2])==2 and S[0]==S[2]:exit(print("Yes"))
if sum(cands[0])==2 and sum(cands[1])==2 and sum(cands[2])==1 and S[0]==S[1]:exit(print("Yes"))
if sum(cands[0])==3 and sum(cands[1])==3 and sum(cands[2])==3 and S[0]==S[1]==S[2]:exit(print("Yes"))
print("No")