Submission #79956

# Submission time Handle Problem Language Result Execution time Memory
79956 2018-10-17T16:17:01 Z pzdba Baza (COCI17_baza) C++14
50 / 50
155 ms 30408 KB
#include <bits/stdc++.h>
using namespace std;
int a[1005][1005];
int b[1005];
int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++) scanf("%d", &a[i][j]);
	}
	int q;
	scanf("%d", &q);
	for(int i=1;i<=q;i++){
		for(int j=1;j<=m;j++) scanf("%d", &b[j]);
		int ans = 0;
		for(int i=1;i<=n;i++){
			bool ok = 1;
			for(int j=1;j<=m;j++){
				if(b[j] == a[i][j] || b[j] == -1) continue;
				ok = 0;
			}
			ans += ok;
		}
		printf("%d\n", ans);
	}
}

Compilation message

baza.cpp: In function 'int main()':
baza.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~
baza.cpp:9:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int j=1;j<=m;j++) scanf("%d", &a[i][j]);
                         ~~~~~^~~~~~~~~~~~~~~~
baza.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
baza.cpp:14:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int j=1;j<=m;j++) scanf("%d", &b[j]);
                         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 45 ms 3064 KB Output is correct
2 Correct 29 ms 4348 KB Output is correct
3 Correct 132 ms 9892 KB Output is correct
4 Correct 23 ms 9892 KB Output is correct
5 Correct 66 ms 11136 KB Output is correct
6 Correct 109 ms 16040 KB Output is correct
7 Correct 155 ms 22004 KB Output is correct
8 Correct 89 ms 23316 KB Output is correct
9 Correct 59 ms 26208 KB Output is correct
10 Correct 138 ms 30408 KB Output is correct