Submission #1776492
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int m = scanner.nextInt(); String[] a = new String[n]; String[] b = new String[m]; for (int i = 0; i < n; i++) { a[i] = scanner.next(); } for (int i = 0; i < m; i++) { b[i] = scanner.next(); } int count = 0; for (int i = 0; i < n - m+1; i++) { for (int j = 0; j < n - m+1; j++) { for (int k = 0; k < m; k++) { String str = a[i + k].substring(j, j + m); //System.out.println(str + ":" + b[k]); if (str.equals(b[k])) { count++; } } if (count == m) { System.out.println("Yes"); return; } count = 0; } } System.out.println("No"); } }
Submission Info
Submission Time | |
---|---|
Task | B - Template Matching |
User | unirita152 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 820 Byte |
Status | AC |
Exec Time | 116 ms |
Memory | 21844 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 | 93 ms | 20820 KB |
sample_02.txt | AC | 92 ms | 19156 KB |
subtask_1_01.txt | AC | 92 ms | 18644 KB |
subtask_1_02.txt | AC | 94 ms | 21204 KB |
subtask_1_03.txt | AC | 95 ms | 21332 KB |
subtask_1_04.txt | AC | 98 ms | 19664 KB |
subtask_1_05.txt | AC | 101 ms | 21844 KB |
subtask_1_06.txt | AC | 116 ms | 21844 KB |
subtask_1_07.txt | AC | 115 ms | 21076 KB |
subtask_1_08.txt | AC | 109 ms | 21716 KB |