Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int a[1000][1000], b[1000][1000];
- int main() {
- freopen("MENU.inp", "r", stdin);
- freopen("MENU.out", "w", stdout);
- ios_base::sync_with_stdio(false);
- cin.tie(0); cout.tie(0);
- int n, m; cin >> n>> m;
- for (int i = 1; i <= n; ++i)
- for(int j = 1; j <= m; ++j)
- cin >> a[i][j];
- int q; cin >> q;
- for (int i = 1; i <= q; ++i)
- for(int j = 1; j <= m; ++j)
- cin >> b[i][j];
- for(int k = 1; k <= q; ++k){
- int res = 0;
- for (int i = 1; i <= n; ++i){
- int no = 0;
- for(int j = 1; j <= m; ++j){
- if (b[k][j] != -1 && b[k][j] != a[i][j]){
- no = 1;
- }
- }
- if (no == 0) res++;
- }
- cout << res << '\n';
- }
- return 0;
- }
- /*
- 3 8
- 6 5 97 99 82 50 95 1
- 85 62 11 64 94 84 88 19
- 43 99 11 64 94 84 31 19
- 3
- -1 -1 11 64 94 84 -1 19
- -1 -1 -1 99 -1 -1 -1 1
- 95 -1 -1 -1 -1 80 -1 -1
- */
Advertisement
Add Comment
Please, Sign In to add comment