# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
249025 | Vladikus004 | Baza (COCI17_baza) | C++14 | 137 ms | 9080 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
const int N = 1000 + 3;
int n, m, a[N][N], q, b[N];
int can(int ind){
int ans = 1;
for (int i = 0; i < m; i++){
if (b[i] != -1 && a[ind][i] != b[i]) ans = 0;
}
return ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif // LOCAL
cin >> n >> m;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
cin >> a[i][j];
}
}
cin >> q;
while (q--){
for (int i = 0; i < m; i++) cin >> b[i];
int ans = 0;
for (int i = 0; i < n; i++) ans += can(i);
cout << ans << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |