結果

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

ソースコード

diff #

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

using i32 = int;
using i64 = long long;
using f64 = long double;
using i128 = __int128_t;
using p2 = pair<i64, i64>;
using el = tuple<i64, i64, i64>;

void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}

i64 pow(i64 x, i64 n) {
  i64 res = 1;
  i64 t = x;
  while (n > 0) {
    if (n & 1) {
      res = res * t;
    }
    t = t * t;
  }
  return res;
}

void _main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  vector<string> s = {s1, s2, s3};
  sort(s.begin(), s.end());
  vector<string> a1 = {"gray","brown","green","cyan","blue","yellow","orange","red"};
  vector<string> a2 = {"gray","green","blue","yellow","red"};
  vector<string> a3 = {"gray","green","cyan","blue","violet","orange","red"};
  i64 ans = 0;
  for (i64 i = 0; i < a1.size(); i++) {
    for (i64 j = 0; j < a2.size(); j++) {
      for (i64 k = 0; k < a3.size(); k++) {
        vector<string> t = {a1[i], a2[j], a3[k]};
        sort(t.begin(), t.end());
        if (s == t) {
          ans++;
        }
      }
    }
  }
  if (ans == 1) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}
0