結果

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

ソースコード

diff #

#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic warning "-Wunused-function"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;

set<string> d[3]{
  {"gray","brown","green","cyan","blue","yellow","orange","red"},
  {"gray","green","blue","yellow","red"},
  {"gray","green","cyan","blue","violet","orange","red"}
};

} int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s[3];
  rep(i, 3) cin >> s[i];
  sort(all(s));
  int cnt = 0;
  do {
    bool ok = true;
    rep(i, 3) ok &= d[i].contains(s[i]);
    cnt += ok;
  } while (next_permutation(all(s)));
  cout << (cnt == 1 ? "Yes\n" : "No\n");
}
0