이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |