結果

問題 No.3171 Color Restoration
ユーザー a01sa01to
提出日時 2025-06-07 00:46:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 879 bytes
コンパイル時間 3,606 ms
コンパイル使用メモリ 289,672 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-07 00:46:08
合計ジャッジ時間 4,694 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  set<string> a = { "gray", "brown", "green", "cyan", "blue", "yellow", "orange", "red" },
              b = { "gray", "green", "blue", "yellow", "red" },
              c = { "gray", "green", "cyan", "blue", "violet", "orange", "red" };
  string s, t, u;
  cin >> s >> t >> u;
  vector<string> v = { s, t, u };
  sort(v.begin(), v.end());
  int cnt = 0;
  do {
    if (a.contains(v[0]) && b.contains(v[1]) && c.contains(v[2])) ++cnt;
  } while (next_permutation(v.begin(), v.end()));
  if (cnt == 1) {
    cout << "Yes" << '\n';
  }
  else {
    cout << "No" << '\n';
  }
  return 0;
}
0