結果
問題 |
No.3171 Color Restoration
|
ユーザー |
|
提出日時 | 2025-03-15 08:34:31 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 767 bytes |
コンパイル時間 | 3,829 ms |
コンパイル使用メモリ | 302,756 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-06 20:50:15 |
合計ジャッジ時間 | 4,816 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { vector<vector<string>> c = {{"gray","brown","green","cyan","blue","yellow","orange","red"}, {"gray","green","blue","yellow","red"}, {"gray","green","cyan","blue","violet","orange","red"}}; vector<set<string>> col(3); for(int i = 0; i < 3; i++) { for(string o : c[i]) { col[i].insert(o); } } vector<string> S(3); for(string &o : S) { cin >> o; } sort(S.begin(), S.end()); int cnt = 0, tmp = 6; set<vector<string>> p; while(tmp > 0) { bool f = true; for(int i = 0; i < 3; i++) { if(!col[i].count(S[i])) { f = false; } } if(f && !p.count(S)) { cnt++; p.insert(S); } tmp--; next_permutation(S.begin(), S.end()); } cout << (cnt == 1 ? "Yes" : "No") << endl; }