Submission #1254653


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define print(x) cout<<x<<endl;
typedef long long ll;

int main() {
	int N,M;
	string a[52][52], b[52][52];
	int tmp=0,tmp_j=0;
	cin >> N >> M;
	int flag = 1;
	rep(i, 0, N)rep(j, 0, N)cin >> a[i][j];
	rep(i, 0, M)rep(j, 0, M)cin >> b[i][j];

	bool exist = true;
	rep(ly, 0, N) {
		rep(lx, 0, N) {
			if (ly + M - 1 >= N or lx + M - 1 >= N)continue;

			bool match = true;
			rep(y, 0, M) {
				rep(x, 0, M) {
					if (a[ly + y][lx + x] != b[y][x])match = false;
				}
			}
			if (match) exist = true;
		}
	}
	if (exist) { print("Yes"); }
	else print("No");
	return 0;
}

Submission Info

Submission Time
Task B - Template Matching
User ttakano
Language C++14 (GCC 5.4.1)
Score 0
Code Size 689 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 × 1
WA × 1
AC × 4
WA × 6
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 WA 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt WA 1 ms 256 KB
subtask_1_03.txt AC 1 ms 256 KB
subtask_1_04.txt WA 1 ms 256 KB
subtask_1_05.txt WA 1 ms 256 KB
subtask_1_06.txt WA 1 ms 256 KB
subtask_1_07.txt WA 1 ms 256 KB
subtask_1_08.txt AC 1 ms 256 KB