結果
| 問題 | No.3171 Color Restoration |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2025-06-06 21:34:35 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| + 170µs | |
| コード長 | 577 bytes |
| 記録 | |
| コンパイル時間 | 226 ms |
| コンパイル使用メモリ | 95,852 KB |
| 実行使用メモリ | 78,976 KB |
| 最終ジャッジ日時 | 2026-07-11 06:10:08 |
| 合計ジャッジ時間 | 3,619 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
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")
detteiuu