結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; ++i)

int main() {
  string s1,s2,s3;
  cin >> s1 >> s2 >> s3;
  vector<string> onecoder = {"gray","brown","green","cyan","blue","yellow","orange","red"};
  vector<string> twocoder = {"gray","green","blue","yellow","red"};
  vector<string> threeforces = {"gray","green","cyan","blue","violet","orange","red"};
  map<string,ll> cnt;
  map<string,ll> onetwo;
  map<string,ll> twothree;
  map<string,ll> onethree;
  map<string,ll> dup;
  dup[s1]++;
  dup[s2]++;
  dup[s3]++;
  for(string s : onecoder){
    cnt[s]++;
    onetwo[s]++;
    onethree[s]++;
  }
  for(string s : twocoder){
    cnt[s]++;
    onetwo[s]++;
    twothree[s]++;
  }
  for(string s : threeforces){
    cnt[s]++;
    onethree[s]++;
    twothree[s]++;
  }
  ll temp = 0;
  bool ok = false;
  if(cnt[s1] == 1 && dup[s1] == 1 && ((twothree[s2] == 1 && dup[s2] == 1) || (twothree[s3] == 1 && dup[s3] == 1)))ok = true;
  if(cnt[s2] == 1 && dup[s2] == 1 && ((onethree[s1] == 1 && dup[s1] == 1) || (onethree[s3] == 1 && dup[s3] == 1)))ok = true;
  if(cnt[s3] == 1 && dup[s3] == 1 && ((onetwo[s1] == 1 && dup[s1] == 1) || (onetwo[s2] == 1 && dup[s2] == 1)))ok = true;
  if(cnt[s1] == 1 && dup[s1] == 1 && twothree[s2] >= 2 && dup[s2] == 2)ok = true;
  if(cnt[s2] == 1 && dup[s2] == 1 && onethree[s1] >= 2 && dup[s1] == 2)ok = true;
  if(cnt[s3] == 1 && dup[s3] == 1 && onetwo[s1] >= 2 && dup[s1] == 2)ok = true;
  if(cnt[s1] == 3 && dup[s1] == 3)ok = true;
  if(ok){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}
0