#include #include #define pass (void)0 #define INF (1<<30)-1 #define INFLL (1LL<<60)-1 using namespace std; using namespace atcoder; using mint = modint998244353; using ll = long long; int main() { int N, M; cin >> N >> M; vector S(M); for (int i = 0; i < M; i++) { cin >> S[i]; } vector binS(M); for (int i = 0; i < M; i++) { int num = 0; for (int j = 0; j < N; j++) { if (S[i][j] == '1') { num |= 1 << j; } } binS[i] = num; } unordered_set SET(binS.begin(), binS.end()); if (SET.find((1 << N) - 1) == SET.end() || SET.find(0) == SET.end()) { cout << "No" << endl; return 0; } for (int i = 0; i < M - 1; i++) { for (int j = i + 1; j < M; j++) { if (SET.find(binS[i] & binS[j]) == SET.end()) { cout << "No" << endl; return 0; } } } vector now(1 << N, false); now[0] = true; for (int i = 0; i < M; i++) { vector nex(1<