結果
問題 |
No.3171 Color Restoration
|
ユーザー |
![]() |
提出日時 | 2025-06-07 00:24:26 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 934 bytes |
コンパイル時間 | 3,787 ms |
コンパイル使用メモリ | 289,636 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-07 00:24:32 |
合計ジャッジ時間 | 5,545 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() template <class T> using V=vector<T>; template <class T> using VV=V<V<T>>; using u128=__int128_t; using ll=long long; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); VV<string> A={ {"gray","brown","green","cyan","blue","yellow","orange","red"}, {"gray","green","blue","yellow","red"}, {"gray","green","cyan","blue","violet","orange","red"} }; V<string> B(3); rep(i,3) cin>>B[i]; V<int> C(3); rep(i,3) C[i]=i; int cnt=0; set<array<string,3>> st; do{ array<string,3> tmp; int c=0; rep(i,3){ for(auto x:A[C[i]]){ if(x==B[i]){ tmp[C[i]]=x; c++; } } } if(c==3) st.insert(tmp); }while(next_permutation(ALL(C))); if(st.size()==1) cout<<"Yes"<<endl; else cout<<"No"<<endl; return 0; }