답안 #465294

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
465294 2021-08-15T14:03:55 Z rainboy Baza (COCI17_baza) C
50 / 50
120 ms 8932 KB
#include <stdio.h>

#define N	1000
#define M	1000

int main() {
	static int aa[N][M], bb[M];
	int n, m, q, i, j;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++)
			scanf("%d", &aa[i][j]);
	scanf("%d", &q);
	while (q--) {
		int cnt;

		for (j = 0; j < m; j++)
			scanf("%d", &bb[j]);
		cnt = 0;
		for (i = 0; i < n; i++) {
			int match = 1;

			for (j = 0; j < m; j++)
				if (bb[j] != -1 && aa[i][j] != bb[j]) {
					match = 0;
					break;
				}
			if (match)
				cnt++;
		}
		printf("%d\n", cnt);
	}
	return 0;
}

Compilation message

baza.c: In function 'main':
baza.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
baza.c:13:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |    scanf("%d", &aa[i][j]);
      |    ^~~~~~~~~~~~~~~~~~~~~~
baza.c:14:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  scanf("%d", &q);
      |  ^~~~~~~~~~~~~~~
baza.c:19:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |    scanf("%d", &bb[j]);
      |    ^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 2816 KB Output is correct
2 Correct 20 ms 2628 KB Output is correct
3 Correct 63 ms 7040 KB Output is correct
4 Correct 21 ms 2304 KB Output is correct
5 Correct 51 ms 4236 KB Output is correct
6 Correct 76 ms 6596 KB Output is correct
7 Correct 97 ms 8932 KB Output is correct
8 Correct 60 ms 5484 KB Output is correct
9 Correct 37 ms 5444 KB Output is correct
10 Correct 120 ms 7700 KB Output is correct