Untitled
#include <iostream> #include <vector> using namespace std; int n, map[20][20]; void init(int N, int mMap[20][20]) { n = N; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { map[i][j] = mMap[i][j]; } } } int numberOfCandidate(int M, int mStructure[5]) { if (M == 1) return n * n; vector<int> v(mStructure, mStructure + M); vector<int> re_v(v.rbegin(), v.rend()); int cnt = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { bool check_hozion = true, check_vertical = true; for (int k = 0; k < M - 1 && (check_hozion || check_vertical); k++) { if (j + M - 1 < n) { if (map[i][j + k] + v[k] != map[i][j + k + 1] + v[k + 1] && map[i][j + k] + re_v[k] != map[i][j + k + 1] + re_v
Leave a Comment