Untitled
unknown
plain_text
10 months ago
1.4 kB
5
Indexable
#include <iostream> #include <unordered_map> #include <map> #include <cstring> #include <algorithm> #include <string> #define MAX_SIZE 1000 using namespace std; int n; int step; unordered_map<string, string> mp; int visit[MAX_SIZE][MAX_SIZE]; int mat[MAX_SIZE][MAX_SIZE]; void init(int N, int mPlane[MAX_SIZE][MAX_SIZE]) { //Reset mp.clear(); n = N; step = 0; for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { mat[i][j] = mPlane[i][j]; } } memset(visit, 0, sizeof(visit)); //Hash map for(int i=0; i<n-3; i+=5) { for(int j=0; j<n-3; j+=5) { int cnt = 0; bool check = false; string s = ""; for(int r=i; r<i+5; r++) { for(int c=j; c<j+5; c++) { if(mat[i][j] == 1) { cnt++; if(mat[i][c] == 1 || mat[i+4][c] == 1 || mat[r][j] == 1 || mat[r][j+4] == 1) { check = true; } } cout<<cnt<<endl; } } cout<<cnt<<endl; if(check && cnt==7) { for(int r=i; r<i+5; r++) { for(int c=j; c<j+5; c++) { visit[r][c] = step; s += to_string(mat[i][j]); } } mp[s] = step; step++; } } } for(auto it : mp){ cout<<1<<endl; cout << it.first << " " << it.second << endl; } } int getCount(int mPiece[5][5]) { return 0; } int getPosition(int mRow, int mCol) { return 0; }
Editor is loading...
Leave a Comment