Submission #1104862


Source Code Expand

package main

import "fmt"

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	A := make([][]byte, N)
	B := make([][]byte, M)
	var s string
	for i := 0; i < N; i++ {
		fmt.Scan(&s)
		for j := 0; j < N; j++ {
			A[i] = append(A[i], s[j])
		}
	}
	for i := 0; i < M; i++ {
		fmt.Scan(&s)
		for j := 0; j < M; j++ {
			B[i] = append(B[i], s[j])
		}
	}
	// fmt.Println(A)
	// fmt.Println(B)
	for i := 0; i < N-M; i++ {
		for j := 0; j < N-M; j++ {
			c := true
			for y := 0; y < M; y++ {
				for x := 0; x < M; x++ {
					// fmt.Println(y, x, i, j, y+i, x+j)
					if A[y+i][x+j] != B[y][x] {
						c = false
						break
					}
				}
			}
			if c == true {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}

Submission Info

Submission Time
Task B - Template Matching
User fmhr
Language Go (1.6)
Score 0
Code Size 759 Byte
Status WA
Exec Time 4 ms
Memory 512 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 2
AC × 9
WA × 1
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 512 KB
sample_02.txt AC 1 ms 512 KB
subtask_1_01.txt WA 1 ms 512 KB
subtask_1_02.txt AC 1 ms 512 KB
subtask_1_03.txt AC 1 ms 512 KB
subtask_1_04.txt AC 1 ms 512 KB
subtask_1_05.txt AC 2 ms 512 KB
subtask_1_06.txt AC 4 ms 512 KB
subtask_1_07.txt AC 3 ms 512 KB
subtask_1_08.txt AC 2 ms 512 KB