結果
問題 |
No.3171 Color Restoration
|
ユーザー |
|
提出日時 | 2025-07-11 20:17:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,343 bytes |
コンパイル時間 | 2,410 ms |
コンパイル使用メモリ | 206,240 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-07-11 20:17:46 |
合計ジャッジ時間 | 3,910 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long // #define rep(i,n) for(int i=0;i<(int)n;i++) #define rep(i,r) for(ll i=0;i<(ll)r;i++) #define vi vector<int> #define vl vector<ll> #define vd vector<double> #define vb vector<bool> #define vs vector<string> #define vc vector<char> #define ull unsigned long long #define chmax(a,b) a=max(a,b) #define chmin(a,b) a=min(a,b) // ll inf=(1ll<<62); // ll rui(ll a,ll b){ // if(b==0)return 1; // if(b%2==1) return a*rui(a*a,b/2); // return rui(a*a,b/2); // } // ll const mod=998244353ll; // ll modrui(ll a,ll b){ // if(b==0)return 1; // if(b%2==1) return a%mod*modrui(a%mod*a%mod,b/2)%mod; // return modrui(a%mod*a%mod,b/2)%mod; // } void solve(){ vs s1={"gray","brown","green","cyan","blue","yellow","orange","red"}, s2={"gray","green","blue","yellow","red"}, s3={"gray","green","cyan","blue","violet","orange","red"}; int cnt=0; vs t(3); rep(i,3)cin >> t[i]; sort(t.begin(),t.end()); do{ if( find(s1.begin(),s1.end(),t[0])!=s1.end() && find(s2.begin(),s2.end(),t[1])!=s2.end() && find(s3.begin(),s3.end(),t[2])!=s3.end())cnt++; }while (next_permutation(t.begin(),t.end())); cout << (cnt==1? "Yes\n":"No\n"); } int main(){ ll t=1; // cin >> t; while(t--)solve(); }