Submission #1592526


Source Code Expand

#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>

using namespace std;

int main() {
	int i, j, k, t, N, M;
	char A[51][51], B[51][51];

	cin >> N >> M;

	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			cin >> A[i][j];
		}
	}

	for (i = 0; i < M; i++) {
		for (j = 0; j < M; j++) {
			cin >> B[i][j];
		}
	}

	int flag;
	//cout << endl;
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			//cout<< A[i][j];
			flag = 0;
			for (k = i; k < M+i; k++) {
				if (k > 49) {
					flag = 1;
					break;
				}
				for (t = j; t < M+j; t++) {
					//cout << B[k][t];
					if (t > 49) {
						flag = 1;
						break;
					}
					if (B[k][t] != A[k][t]) {
						flag = 1;
						break;
					}
				}
				if (flag == 1) break;
				//cout << endl;
			}
			if (flag == 0) {
				cout << "Yes" << endl;
				
			
				return 0;
			}
		}
		//cout << endl;
	}

	cout << "No" << endl;


	/*
	for (i = 0; i < M; i++) {
		for (j = 0; j < M; j++) {
			cout<< B[i][j];
		}
		cout << endl;
	}
	*/









	return 0;
}

Submission Info

Submission Time
Task B - Template Matching
User texico
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1143 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 2
AC × 8
WA × 2
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 WA 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 1 ms 256 KB
subtask_1_07.txt AC 1 ms 256 KB
subtask_1_08.txt WA 1 ms 256 KB