Submission #143976

# Submission time Handle Problem Language Result Execution time Memory
143976 2019-08-15T14:11:01 Z 44442 Baza (COCI17_baza) C++11
50 / 50
272 ms 9464 KB
#include <bits/stdc++.h>
using namespace std;
int n,m,q,a[1004][1004],b[60][1004],ok,v[60][1004];
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
     cin>>n>>m;
     for(int i=0;i<n;i++){
     	 for(int j=0;j<m;j++){
     	 	 cin>>a[i][j];
		  } 
	 }
	 cin>>q;
	 for(int d=0;d<q;d++){
	 	 for(int j=0;j<m;j++){
	 	 	 cin>>b[d][j];
		  }
     }
     for(int d=0;d<q;d++){
     	 ok=0;
	 for(int i=0;i<n;i++){
	     for(int j=0;j<m;j++){
	 	     if(b[d][j]!=-1){
	 	     	 if(!v[d][i] and a[i][j]!=b[d][j])
	 	     	     v[d][i]=1;
		     }
	     }
	     if(!v[d][i])
		     ok++;
     }
     cout<<ok<<endl;
     }
     
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 55 ms 3192 KB Output is correct
2 Correct 36 ms 2908 KB Output is correct
3 Correct 177 ms 7528 KB Output is correct
4 Correct 30 ms 2724 KB Output is correct
5 Correct 82 ms 4472 KB Output is correct
6 Correct 179 ms 7336 KB Output is correct
7 Correct 272 ms 9464 KB Output is correct
8 Correct 132 ms 5880 KB Output is correct
9 Correct 80 ms 5752 KB Output is correct
10 Correct 209 ms 8184 KB Output is correct