# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
490102 | FronPaw | Baza (COCI17_baza) | C++14 | 247 ms | 8940 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 <iostream>
#include <vector>
#include <map>
using namespace std;
int n, m, q;
int a[1001][1001];
int v[1001];
int main ()
{
cin >> n >> m;
for (int i = 1;i<=n;++i)
for(int j = 1;j<=m;++j)
{
int nr;
cin >> nr;
a[i][j] = nr;
}
cin >> q;
for (int test = 1;test <= q;++test)
{
for (int i = 1;i<=m;++i)
cin >> v[i];
bool rasp[1001];
int ans = 0;
for (int i = 1;i<=n;++i)
rasp[i] = 1;
for (int i = 1;i<=m;++i)
{
if (v[i] == -1)
continue;
for (int j = 1;j<=n;++j)
if (a[j][i] != v[i])
rasp[j] = 0;
}
for (int i = 1;i<=n;++i)
if (rasp[i] == 1)
ans++;
cout << ans << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |