Submission #10313616
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define ll long long /*"itob" int to "N"base */ template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;} /*"chmin" a = MAX*/ template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } /*"chmax" a = MIN*/ template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } /*"ctoi" char to int*/ int ctoi(char c) {return c-'0';} /*"gcd" MAX*/ int gcd(ll a,ll b){return b?gcd(b,a%b):a;} /*"lcm" MIN*/ int lcm(ll a,ll b){return a*b/gcd(a,b);} /*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}} string reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;} int main() { int n,m; cin >> n >> m; vector<string>a(n),b(m); for(int i=0;i<n;i++){ cin >> a.at(i); } for(int i=0;i<m;i++){ cin >> b.at(i); } for(int i=0;i<n;i++){ vector<string>s(n); for(int j=0;j<n;j++){ s.at(j)=a.at(j).substr(i,m); } bool che = true; for(int j=0;j<n;j++){ for(int k=0;k<m;k++){ if(j+k>=n){break;} if(b.at(k)!=s.at(j+k))che=false; if(k==m-1&&che){cout<<"Yes"<<endl;return 0;} } } } cout << "No"<<endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Template Matching |
User | himo |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1789 Byte |
Status | WA |
Exec Time | 2 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 | AC | 1 ms | 256 KB |
subtask_1_03.txt | WA | 1 ms | 256 KB |
subtask_1_04.txt | AC | 1 ms | 256 KB |
subtask_1_05.txt | AC | 1 ms | 256 KB |
subtask_1_06.txt | AC | 2 ms | 256 KB |
subtask_1_07.txt | AC | 2 ms | 256 KB |
subtask_1_08.txt | WA | 1 ms | 256 KB |