Submission #1111367

Source Code Expand

Copy
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;

const int nax=52;
int M,N;
char A[52][52],B[52][52];
bool b=false,a=false;

int main(){
    scanf("%d %d",&N,&M);
    for(int i=0;i<N;i++){
                scanf("%s",&A[i]);
    }
    for(int i=0;i<M;i++){
                scanf("%s",&B[i]);
    }
    //printf("%s %s %d %d\n",A[0],B[0],N,M);
//--------------------------------------
    for(int i=0;i<N-M+1;i++){
        for(int j=0;j<N-M+1;j++){
                                b=false;
            for(int k=0;k<M;k++){
                for(int l=0;l<M;l++){
                    if(A[i+k][j+l]!=B[k][l]){
                        b=true;
                        break;
                    }
                }
                if(b){
                    break;
                }
            }

        if(!b){
            printf("Yes");
            return 0;
        }
        }

    }
    printf("No" );
        return 0;
}

Submission Info

Submission Time
Task B - Template Matching
User Nafmo2
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1053 Byte
Status
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:33: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[52]’ [-Wformat=]
                 scanf("%s",&A[i]);
                                 ^
./Main.cpp:20:33: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[52]’ [-Wformat=]
                 scanf("%s",&B[i]);
                                 ^
./Main.cpp:15:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&N,&M);
                         ^
./Main.cpp:17:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%s",&A[i]);
                                  ^
./Main.cpp:20:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%s",&B[i])...

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 200 / 200 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 1 ms 256 KB
sample_02.txt 1 ms 256 KB
subtask_1_01.txt 1 ms 256 KB
subtask_1_02.txt 1 ms 256 KB
subtask_1_03.txt 1 ms 256 KB
subtask_1_04.txt 1 ms 256 KB
subtask_1_05.txt 1 ms 256 KB
subtask_1_06.txt 1 ms 256 KB
subtask_1_07.txt 1 ms 256 KB
subtask_1_08.txt 1 ms 256 KB