답안 #490102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
490102 2021-11-25T16:34:00 Z FronPaw Baza (COCI17_baza) C++14
50 / 50
247 ms 8940 KB
#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';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 2756 KB Output is correct
2 Correct 44 ms 2628 KB Output is correct
3 Correct 140 ms 7060 KB Output is correct
4 Correct 34 ms 2376 KB Output is correct
5 Correct 106 ms 4228 KB Output is correct
6 Correct 160 ms 6728 KB Output is correct
7 Correct 247 ms 8940 KB Output is correct
8 Correct 142 ms 5544 KB Output is correct
9 Correct 83 ms 5448 KB Output is correct
10 Correct 212 ms 7804 KB Output is correct