Submission #10313252
Source Code Expand
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <bits/stdc++.h> #include<queue> #include <numeric> #include<stdio.h> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; } //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define fore(i,a) for(auto &i:a) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) LL gcd(LL a, LL b){ if(b == 0) return a; return gcd(b,a%b); } LL lcm(LL a, LL b){ LL g = gcd(a,b); return a/g *b; } int main(){ int N,M; cin >> N >> M; string A[N],B[M]; for(int i=0;i<N;++i){ cin >> A[i]; } bool exist=false; for(int i=0;i<M;++i){ cin >> B[i]; } bool right=true; for(int i=0;i<N;++i){ for(int j=0;j<N;++j){ right=true; for(int k=0;k<M;++k){ for(int l=0;l<M;++l){ if(i+k<N && j+l<N){ if(A[i+k][j+l]!=B[k][l]){ right=false; } } } } if(right==true){ exist=true; } } } if(exist){ cout << "Yes" << endl; } else{ cout << "No" << endl; } }
Submission Info
Submission Time | |
---|---|
Task | B - Template Matching |
User | ImaGe |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2864 Byte |
Status | WA |
Exec Time | 20 ms |
Memory | 256 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 | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | AC | 1 ms | 256 KB |
subtask_1_02.txt | WA | 1 ms | 256 KB |
subtask_1_03.txt | AC | 1 ms | 256 KB |
subtask_1_04.txt | AC | 2 ms | 256 KB |
subtask_1_05.txt | WA | 1 ms | 256 KB |
subtask_1_06.txt | AC | 20 ms | 256 KB |
subtask_1_07.txt | AC | 10 ms | 256 KB |
subtask_1_08.txt | AC | 1 ms | 256 KB |