#include<cstdio>
int N,M,R,C;
int A[1010][1010];
int B[1010][1010];
int main()
{
scanf("%d%d",&N,&M);
for(int i=0;i<N;i++)
for(int j=0;j<M;j++)
scanf("%d",&A[i][j]);
scanf("%d%d",&R,&C);
for(int i=0;i<R;i++)
for(int j=0;j<C;j++)
scanf("%d",&B[i][j]);
int cnt=0;
for(int i=0;i<N-R+1;i++)
{
for(int j=0;j<M-C+1;j++)
{
int iA=-1,iB=-1;
int iA2=-1,iB2=-1;
bool f=true;
for(int k=0;k<R && f;k++)
for(int s=0;s<C && f;s++)
{
int tA=A[k+i][s+j];
int tB=B[k][s];
if(iA==-1)
{
iA=tA;iB=tB;
}
else if(iA2==-1 && (iA!=tA || iB!=tB) )
{
iA2=tA;
iB2=tB;
if(iA2==iA) f=false;
}
else
{
if(1LL*(iA-tA)*(iB2-tB)!=1LL*(iA2-tA)*(iB-tB)) f=false;
}
}
if(f) cnt++;
}
}
printf("%d",cnt);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
9052 KB |
Output is correct |
2 |
Correct |
0 ms |
9052 KB |
Output is correct |
3 |
Correct |
0 ms |
9052 KB |
Output is correct |
4 |
Correct |
0 ms |
9052 KB |
Output is correct |
5 |
Correct |
0 ms |
9052 KB |
Output is correct |
6 |
Correct |
0 ms |
9052 KB |
Output is correct |
7 |
Correct |
0 ms |
9052 KB |
Output is correct |
8 |
Correct |
0 ms |
9052 KB |
Output is correct |
9 |
Correct |
0 ms |
9052 KB |
Output is correct |
10 |
Correct |
0 ms |
9052 KB |
Output is correct |
11 |
Correct |
0 ms |
9052 KB |
Output is correct |
12 |
Correct |
3 ms |
9052 KB |
Output is correct |
13 |
Correct |
3 ms |
9052 KB |
Output is correct |
14 |
Correct |
5 ms |
9052 KB |
Output is correct |
15 |
Correct |
14 ms |
9052 KB |
Output is correct |
16 |
Correct |
0 ms |
9052 KB |
Output is correct |
17 |
Correct |
0 ms |
9052 KB |
Output is correct |
18 |
Correct |
0 ms |
9052 KB |
Output is correct |
19 |
Correct |
0 ms |
9052 KB |
Output is correct |
20 |
Correct |
0 ms |
9052 KB |
Output is correct |
21 |
Correct |
14 ms |
9052 KB |
Output is correct |
22 |
Correct |
11 ms |
9052 KB |
Output is correct |
23 |
Correct |
8 ms |
9052 KB |
Output is correct |
24 |
Correct |
0 ms |
9052 KB |
Output is correct |
25 |
Correct |
0 ms |
9052 KB |
Output is correct |
26 |
Correct |
0 ms |
9052 KB |
Output is correct |
27 |
Correct |
0 ms |
9052 KB |
Output is correct |
28 |
Correct |
0 ms |
9052 KB |
Output is correct |
29 |
Correct |
0 ms |
9052 KB |
Output is correct |
30 |
Correct |
0 ms |
9052 KB |
Output is correct |
31 |
Correct |
0 ms |
9052 KB |
Output is correct |
32 |
Correct |
0 ms |
9052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
158 ms |
9052 KB |
Output is correct |
2 |
Correct |
118 ms |
9052 KB |
Output is correct |
3 |
Correct |
223 ms |
9052 KB |
Output is correct |
4 |
Correct |
5221 ms |
9052 KB |
Output is correct |
5 |
Execution timed out |
10000 ms |
9048 KB |
Program timed out |
6 |
Halted |
0 ms |
0 KB |
- |