#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #if __has_include() #include using namespace atcoder; #endif #include #include using namespace std; using namespace chrono; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= (n); ++i) #define rrep(i, n) for (ll i = n; i > 0; --i) #define bitrep(i, n) for (ll i = 0; i < (1 << n); ++i) #define all(a) (a).begin(), (a).end() #define yesNo(b) ((b) ? "Yes" : "No") using ll = long long; using ull = unsigned long long; using ld = long double; using mint = modint998244353; using MINT = modint1000000007; string alphabet = "abcdefghijklmnopqrstuvwxyz"; string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; constexpr double pi = 3.141592653589793; constexpr ll smallMOD = 998244353; constexpr ll bigMOD = 1000000007; constexpr ll dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; constexpr ll dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; struct Init { Init() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(15); } } init; template ostream &operator<<(ostream &os, const vector &vec) { os << "["; rep(i, vec.size()) { os << vec[i]; if (i != vec.size() - 1) os << ", "; } os << "]"; return os; } template ostream &operator<<(ostream &os, const vector> &vec) { os << "["; rep(i, vec.size()) { os << vec[i]; if (i != vec.size() - 1) os << ", "; } os << "]"; return os; } template ostream &operator<<(ostream &os, const pair &pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; } template ostream &operator<<(ostream &os, const set &st) { os << "{"; for (auto itr = st.begin(); itr != st.end(); ++itr) { os << *itr; if (next(itr) != st.end()) os << ", "; } os << "}"; return os; } int main() { ll n, m; cin >> n >> m; vector s(m); rep(i, m) cin >> s[i]; set set_s; rep(i, m) set_s.insert(s[i]); string t = string(n, '1'); if (set_s.find(t) == set_s.end()) { cout << "No" << endl; return 0; } for (ll i = 0; i < n; i++) { for (ll j = i + 1; j < n; j++) { // bit string t1 = s[i]; string t2 = s[j]; // bit積 string t3 = t1; for (ll k = 0; k < n; k++) { if (t1[k] == '1' && t2[k] == '1') { t3[k] = '1'; } else { t3[k] = '0'; } } if (set_s.find(t3) == set_s.end()) { cout << "No" << endl; return 0; } } } bitrep(i, m) { vector sel_s; rep(j, m) { if (i & (1 << j)) { sel_s.push_back(s[j]); } } // sel_sのbit和 string t4 = string(n, '0'); for (ll j = 0; j < sel_s.size(); j++) { for (ll k = 0; k < n; k++) { if (sel_s[j][k] == '1') { t4[k] = '1'; } } } if (set_s.find(t4) == set_s.end()) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }