RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00439

Baza

Unrated 레이팅 미적용
난이도
1s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

1 \(s / 64\) \(MB / 50\) points

Mirko got a summer internship in a big IT company. This company builds a large database

consisting of \(N\)

rows and \(M\)

columns.

On his first day, Mirko received a total of \(Q\) queries. Each query consists of \(M\) numbers.

However, some numbers got lost during transition, so they are denoted wi\(th -1\). Mirko wants

to know how many rows of the database correspond to the query, i.e., how many rows of the

database have identical numbers as the query, excludi\(ng -1\).

For example, if the query is in the form of -1 3 2 , then we need to count the rows of the

database that have any number in the first column, have the number 3 in the second

column, and have the number 2 in the third column.

Since he just started with his internship, Mirko needs your help. Help him and answer the

queries!

제약
입력 형식

The first line of input contains \(N\)

(1 ≤ \(N\)

≤ 10 {3}{ }) and \(M\)

(1 ≤ \(M\)

≤ 10 {3}{ }), the size of the database.
Each of the following \(N\)

lines contains \(M\)

numbers \(A\)

\(ij\)

(1 ≤ \(A\)

\(ij\)

≤ 10 {6}{ }), the content of the
database.
The following line contains \(Q\)

(1 ≤ \(Q\)

≤ 50), the number of queries.
Each of the following \(Q\)

lines contains \(M\)

numbers \(B\)

\(ij\)

( \(B\)

\(ij\)

= -1 or 1 ≤ \(B\)

\(ij\)

≤ 10 {6}{ }), the description
of the \(i\)

\(th\)

query.

출력 형식

The output must contain \(Q\)

lines, each line containing \(X\)

, the answer to the \(i\)

\(th\)

query from the
task.

예제 1
입력
4 3
1 5 2
2 3 4
4 3 2
5 4 6
3
-1 -1 2
-1 3 2
-1 -1 -1

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
출력
output
2
2


1 s / 64 MB / 50 points

1
4

1
0
설명

Clarification of the first example:
The first query asks how many rows have the number 2 in the third column. These are rows number 1 (1
5 2) and number 3 (4 3 2).
The second query asks how many rows have the numbers 3 and 2 in the second and third column. This
is only row number 3 (4 3 2).
The third query asks how many rows are there in total, and the answer is obviously 4.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2016/2017 Contest 7

평가 및 의견

Baza

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Baza

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8