Submission #165771

#TimeUsernameProblemLanguageResultExecution timeMemory
165771itiamBaza (COCI17_baza)C++11
50 / 50
413 ms9220 KiB
#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 timeMemoryGrader output
Fetching results...