結果
| 問題 |
No.3171 Color Restoration
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-07 01:08:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,509 bytes |
| コンパイル時間 | 3,182 ms |
| コンパイル使用メモリ | 224,212 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-07 01:08:12 |
| 合計ジャッジ時間 | 4,195 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define vi vector<ll>
#define vii vector<pair<ll, ll>>
#define ii pair<ll, ll>
#define vll vector<long long int>
using ll = long long int;
#define pb push_back
#define ss second
#define ff first
#define fl(i, n) for (ll i = 0; i < n; i++)
#define fl1(i, n) for (ll i = 1; i < n; i++)
#define flc(a, b) for (ll i = a; i <= b; i++)
#define flr(a, b) for (ll i = a; i >= b; i--)
#define nl "\n"
#define br cout << "\n";
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define mod 998244353
#define inf 1e15
void print(vector<ll> &v)
{
for (auto x : v)
cout << x << " ";
cout << endl;
}
double dist[20][20];
map<ll, double> dp;
double f(ll n,ll mask,ll i) {
if(mask == (1 << (2 * n)) - 1) {
//cout << "mask: " << mask << " i: " << i << nl;
return 0.0;
}
if(dp[mask] != 0) return dp[mask];
double ans = inf;
// mask = mask | (1<<i);
for(ll j = 0 ; j<= 2*n ; j++){
if( (mask & (1<<j)) == 0 && (i != j)) {
//cout << i<< " " << j << " " << nl;
ll new_mask = mask | (1<<j) | (1<<i);
for(ll k = 0 ; k <= 2*n ; k++){
if( (new_mask & (1<<k)) == 0) {
//cout << i<< " " << j << " " << k << " " << new_mask << nl;
ans = min(ans, dist[i][j] + f(n,new_mask,k));
}
}
}
}
return dp[mask] = ans;
}
void f(ll l, ll r, vector<pair<ll, ll>> &cls) {
fl(i,3) cout << cls[l].second << " " << cls[r].second << " ";
br
if(l == r) return;
fl(i,3) cout << cls[r].second << " " << cls[l].second << " ";
br
}
void erase (set<ll> &st){
st.erase(st.begin());
}
void solve(){
vector<string> a = {"gray","brown","green","cyan","blue","yellow","orange","red"},
b = {"gray","green","blue","yellow","red"},
c = {"gray","green","cyan","blue","violet","orange","red"};
map<vector<string>,ll> mp;
for(auto x : a )
for( auto y : b)
for (auto z : c){
vector<string> temp = {x,y,z};
sort(all(temp));
mp[temp]++;
}
vector<string> v(3); cin>> v[0]>>v[1]>>v[2];
sort(all(v));
if(mp[v] == 1) cout << "Yes\n";
else cout << "No\n";
}
int main() {
// ios_base::sync_with_stdio(false);
// cin.tie(nullptr);
int t=1;
// cin >> t;
for (int i = 0; i < t; i++) {
solve();
}
return 0;
}