Submission #1774189


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
int a,b; bool f;
char s[51][51],t[51][51];
using namespace std;
int main()
{
	scanf("%d%d",&a,&b);
	for(int i=1;i<=a;++i)
	for(int j=1;j<=a;++j)
	cin>>s[i][j];
	for(int i=1;i<=b;++i)
	for(int j=1;j<=b;++j)
	cin>>t[i][j];
	for(int i=1;i<=a-b+1;++i)
	for(int j=1;j<=a-b+1;++j)
	if(s[i][j]==t[1][1])
	{
		f=true;
		for(int i1=i;i1<=i+b-1;++i1)
		{
			for(int j1=j;j1<=j+b-1;++j1)
			if(s[i1][j1]!=t[i1-i+1][j1-j+1])
			{
				f=false;
				break;
			}
			if(!f)break;
		}
		if(f)
		{
			printf("Yes");
			return 0;
		}
	}
	printf("No");
}

Submission Info

Submission Time
Task B - Template Matching
User Impulse
Language C++14 (GCC 5.4.1)
Score 200
Code Size 615 Byte
Status AC
Exec Time 2 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&a,&b);
                     ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 1 ms 256 KB
subtask_1_03.txt AC 1 ms 256 KB
subtask_1_04.txt AC 1 ms 256 KB
subtask_1_05.txt AC 1 ms 256 KB
subtask_1_06.txt AC 2 ms 256 KB
subtask_1_07.txt AC 2 ms 256 KB
subtask_1_08.txt AC 1 ms 256 KB