結果

問題 No.3171 Color Restoration
ユーザー friedrice
提出日時 2025-03-15 08:40:27
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 712 bytes
コンパイル時間 3,939 ms
コンパイル使用メモリ 294,404 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-06 20:50:12
合計ジャッジ時間 4,578 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 18 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
	while(tmp > 0) {
		bool f = true;
		for(int i = 0; i < 3; i++) {
			if(!col[i].count(S[i])) {
				f = false;
			}
		}
		if(f) {
			cnt++;
		}
		tmp--;
		next_permutation(S.begin(), S.end());
	}
	cout << (cnt == 1 ? "Yes" : "No") << endl;
}
0