Submission #1776232
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(); int count = 0; char[][] a = new char[n][n]; char[][] b = new char[m][m]; for(int i = 0; i < n; i++){ a[i] = scanner.next().toCharArray(); } for(int i = 0; i < m; i++){ b[i] = scanner.next().toCharArray(); } for(int i = 0; i < n-m+1; i++){ count = 0; int l = 0; for(int j = 0; j < n-m+1; j++){ //System.out.println(a[i][j] + ":" + b[i][j]); if(a[i][j] == b[0][l]){ count++; for(int k = 1; k < m; k++){ if(a[i+k][j] == b[k][j]){ count++; l++; } } } } //System.out.println("count :"+ count); if(count == m*m){ System.out.println("Yes"); return; } } System.out.println("No"); } }
Submission Info
Submission Time | |
---|---|
Task | B - Template Matching |
User | unirita152 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 918 Byte |
Status | RE |
Exec Time | 112 ms |
Memory | 22228 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 21716 KB |
sample_02.txt | AC | 94 ms | 21716 KB |
subtask_1_01.txt | AC | 94 ms | 20692 KB |
subtask_1_02.txt | RE | 94 ms | 19028 KB |
subtask_1_03.txt | RE | 96 ms | 21584 KB |
subtask_1_04.txt | RE | 96 ms | 19924 KB |
subtask_1_05.txt | RE | 96 ms | 21844 KB |
subtask_1_06.txt | AC | 112 ms | 21332 KB |
subtask_1_07.txt | RE | 112 ms | 22228 KB |
subtask_1_08.txt | RE | 98 ms | 19028 KB |