Submission #1592146
Source Code Expand
#include <iostream> #include <string> using namespace std; int n, m; void generate_mat(int array[][50], int size) { string tmp; for (int i=0; i<size; i++){ cin >> tmp; for (int j=0; j<tmp.length(); j++){ if (tmp[j] == '.'){ array[i][j] = 0; } else if (tmp[j] == '#'){ array[i][j] = 1; } } } } bool stride_mat(int x[][50], int y[][50], int i, int j) { for (int k=0; k<m; k++){ for (int l=0; l<m; l++){ if (x[i+k][j+l] != y[k][l]){ return false; } } } return true; } int main() { int a[50][50], b[50][50]; cin >> n >> m; generate_mat(a, n); generate_mat(b, m); bool flag = false; for (int i=0; i<n-m+1; i++){ for (int j=0; j<n-m+1; j++){ if (stride_mat(a, b, i, j)){ flag = true; break; } } } if (flag) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Template Matching |
User | gospursgo |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 953 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
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 | 1 ms | 256 KB |
subtask_1_07.txt | AC | 1 ms | 256 KB |
subtask_1_08.txt | AC | 1 ms | 256 KB |