# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165771 | itiam | Baza (COCI17_baza) | C++11 | 413 ms | 9220 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int L[1003][1003];
int L2[1003];
int main(){
int N,M,x,y,Q,rj[53],zb,uk=0;
cin >> N >> M;
for (int i=0;i<N;i++){
for (int j=0;j<M;j++){
cin >> x;
L[i][j]=x;
}
}
cin >> Q;
for (int i=0;i<Q;i++){
zb=0;
for (int j=0;j<M;j++){
cin >> y;
L2[j]=y;
}
if (count(L2,L2+M,-1)!=M){
for (int i2=0;i2<N;i2++){
for (int j2=0;j2<M;j2++){
y=L2[j2];
if (y==-1){
continue;
}
if (y!=L[i2][j2]){
zb=0;
break;
}
zb+=1;
}
if (zb>0) uk+=1;
zb=0;
}
rj[i]=uk;
uk=0;
}
else rj[i]=N;
}
for (int i=0;i<Q;i++) cout << rj[i] << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |