Submission #1103563


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, m;
string a[50], b[50];

bool solve() {
	inc(i, n - m + 1) {
	inc(j, n - m + 1) {
		bool flag = true;
		inc(k, n) {
		inc(l, n) {
			if(b[k][l] != a[k + i][l + j]) { flag = false; }
		}
		}
		if(flag) { return true; }
	}
	}
	
	return false;
}

int main() {
	cin >> n >> m;
	inc(i, n) { cin >> a[i]; }
	inc(i, m) { cin >> b[i]; }
	
	cout << (solve() ? "Yes" : "No") << endl;
	
	return 0;
}

Submission Info

Submission Time
Task B - Template Matching
User FF256grhy
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2036 Byte
Status RE
Exec Time 289 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 2
AC × 6
WA × 1
RE × 3
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 2 ms 256 KB
subtask_1_05.txt RE 289 ms 256 KB
subtask_1_06.txt AC 1 ms 256 KB
subtask_1_07.txt RE 97 ms 256 KB
subtask_1_08.txt RE 98 ms 256 KB