結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
// #include<atcoder/all>
// using mint = atcoder::modint998244353;
using ld = long double;
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    vector<string> S(3);
    rep(i,3)cin>>S[i];

    vector<vector<string>> A={{"gray","brown","green","cyan","blue","yellow","orange","red"},{"gray","green","blue","yellow","red"},{"gray","green","cyan","blue","violet","orange","red"}};

    sort(all(S));
    int cnt=0;
    do{
        bool ok=1;
        rep(i,3){
            if(!count(all(A[i]),S[i])) ok=0;
        }
        cnt+=ok;
    }while(next_permutation(all(S)));
    cout<<(cnt==1?"Yes\n":"No\n");
}
0