結果

問題 No.3171 Color Restoration
ユーザー kenti
提出日時 2025-06-06 21:35:12
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 3,617 ms
コンパイル使用メモリ 289,000 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-06 21:35:18
合計ジャッジ時間 4,595 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    set<string> r1 = {"gray","brown","green","cyan","blue","yellow","orange","red"};
    set<string> r2 = {"gray","green","blue","yellow","red"};
    set<string> r3 = {"gray","green","cyan","blue","violet","orange","red"};
    vector<string> s(3);
    for (string &x : s) cin >> x;
    sort(s.begin(), s.end());
    int ct = 0;
    do {
        if (r1.contains(s[0]) && r2.contains(s[1]) && r3.contains(s[2])) ct++;
    } while (next_permutation(s.begin(), s.end()));
    cout << (ct == 1 ? "Yes" : "No") << "\n";
    return 0;
}
0