Submission #2246947


Source Code Expand

import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  int M = sc.nextInt();
  String[] A = new String[N];
  String[] B = new String[M];
  for(int i = 0;i < N;i++)A[i] = sc.next();
  for(int i = 0;i < M;i++)B[i] = sc.next();
    boolean exist = false;
  boolean bad = false;
  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++){
        if(!(B[i+k].equals(A[i+k].substring(j,j+M)))){
        	bad = true;
        	break;
        	}
      }
      if(!bad)exist = true;
      if(exist)break;
    }
    if(exist){
      System.out.println("Yes");
      break;
    }
  }
  if(!exist)System.out.println("No");
}}

Submission Info

Submission Time
Task B - Template Matching
User Sodeimo
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 767 Byte
Status RE
Exec Time 111 ms
Memory 21844 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 1
RE × 1
AC × 4
RE × 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 92 ms 19796 KB
sample_02.txt RE 95 ms 18772 KB
subtask_1_01.txt AC 92 ms 21844 KB
subtask_1_02.txt AC 92 ms 19924 KB
subtask_1_03.txt RE 93 ms 18772 KB
subtask_1_04.txt RE 97 ms 21076 KB
subtask_1_05.txt RE 99 ms 21588 KB
subtask_1_06.txt AC 105 ms 21460 KB
subtask_1_07.txt RE 111 ms 20052 KB
subtask_1_08.txt RE 97 ms 19924 KB