Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int t;
- cin>>t;
- while(t--)
- {
- int n, k; cin >> n >> k;
- vector <int> chk(k, 0);
- for (int i = 0; i < n; i++){
- string str; cin >> str;
- int cnt = 0;
- for (auto x : str) cnt += x == '1';
- if (cnt == 1){
- int x = -1;
- for (int j = 0; j < k; j++) if (str[j] == '1') x = j;
- chk[x] = true;
- }
- }
- int f = 1;
- for (auto x : chk) if (!x){
- cout << "No\n";
- f = 0;
- break;
- }
- if(f)
- cout << "Yes\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement