Submission #1104858


Source Code Expand

n,m=gets.split.map &:to_i
a=[]
b=[]
n.times do
    a << gets
end
m.times do
    b << gets
end
flag = true
jud = false
(n-m+1).times do |x|
    (n-m+1).times do |y|#始点
        flag = true
        m.times do |i|
            m.times do |j|
                if a[x+i][y+j] != b[i][j]
                    flag = false
                    break
                end
            end
            if !flag
                break
            end
        end
        if flag
            puts "Yes"
            jud = true
            break
        end
    end
    if jud
        break
    end
end

if !jud
    puts "No"
end

Submission Info

Submission Time
Task B - Template Matching
User appllluna
Language Ruby (2.3.3)
Score 200
Code Size 652 Byte
Status AC
Exec Time 9 ms
Memory 1788 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix

Judge Result

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