AtCoder Beginner Contest 054

Submission #1103512

Source codeソースコード

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n, m;
  cin >> n >> m;
  vector<string> a(n), b(m);
  rep (i, n) {
    cin >> a[i];
  }
  rep (i, m) {
    cin >> b[i];
  }
  rep (i, n+1-m) {
    rep (j, n+1-m) {
      bool flag = true;
      rep (k, m) {
        rep (l, m) {
          if (a[i+k][j+l] != b[k][l]) {
            flag = false;
            k = m;
            break;
          }
        }
      }
      if (flag) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");

  return 0;
}

Submission

Task問題 B - Template Matching
User nameユーザ名 mu
Created time投稿日時
Language言語 C++14 (Clang 3.8.0)
Status状態 AC
Score得点 200
Source lengthソースコード長 1422 Byte
File nameファイル名
Exec time実行時間 4 ms
Memory usageメモリ使用量 888 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 4 ms 888 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 AC 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 1 ms 256 KB
subtask_1_07.txt AC 1 ms 256 KB
subtask_1_08.txt AC 1 ms 256 KB