結果
| 問題 | No.3171 Color Restoration |
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2025-06-19 16:34:19 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 179µs | |
| コード長 | 680 bytes |
| 記録 | |
| コンパイル時間 | 1,388 ms |
| コンパイル使用メモリ | 201,924 KB |
| 実行使用メモリ | 9,400 KB |
| 最終ジャッジ日時 | 2026-07-12 07:29:16 |
| 合計ジャッジ時間 | 2,989 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
using ll = long long;
int main(){
vector<string> s(3);
rep(i, 0, 3) cin >> s[i];
vector<vector<string>> v{
{"gray","brown","green","cyan","blue","yellow","orange","red"},
{"gray","green","blue","yellow","red"},
{"gray","green","cyan","blue","violet","orange","red"},
};
sort(s.begin(), s.end());
int a = 0;
do {
vector<int> c(3);
rep(i, 0, 3) {
for(auto e : v[i]) {
if(s[i] == e) c[i]++;
}
}
if(c[0] == 1 && c[1] == 1 && c[2] == 1) a++;
} while(next_permutation(s.begin(), s.end()));
string ans = "No";
if(a == 1) ans = "Yes";
cout << ans << endl;
}
forest3