#include using namespace std; #define ll long long #define ld long double #define rep(i, n) for(int i = 0; i < (int)(n); i ++) #define rrep(i, n) for(int i = (int)(n) - 1; i >= 0; i --) #define pii pair #define pll pair #define vi vector #define vll vector #define vpi vector #define vpll vector #define sll set #define spll set #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define mod 1000000007 #define mod2 998244353 #define inf 1000000000000000000 #define pi acos(-1) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define Sort(a) sort(a.begin(), a.end()) #define Rsort(a) sort(a.rbegin(), a.rend()) #define print(x) for(auto i : (x)) cout << i << " "; cout << endl templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> n >> k; vll a(k); sll s; rep(i, k) { cin >> a[i]; s.insert(a[i]); } bool flag = true; priority_queue< ll, // 要素の型はint vector, // 内部コンテナはstd::vector (デフォルトのまま) greater // 昇順 (デフォルトはstd::less) > queue; for (auto i : a) queue.push(i); while(queue.size() != 0) { auto i = queue.top(); queue.pop(); for (int j = 1; j <= 6; j++) { if (i - j < 1 || (i - j) + (7 - j) >= n) continue; if (s.find((i - j) + (7 - j)) != s.end()) { queue.push(i - j); s.insert(i - j); } } if (s.find(1) != s.end()) { flag = false; break; } } if (flag) cout << "Yes" << endl; else cout << "No" << endl; }