Sgu-262 Symbol Recognition
Question:
Yes K Items N? M Of 01 Matrix (1 <= N, M <= 10, 2 <= K <= 6) To ensure that they are different from each other. N? M Select the least position in the matrix so that only these locations can distinguish this K Matrix.
Solution:
We observe that K And find that if we store all the information that can be distinguished by the two matrices, the required space is 2 K? (K? 1) 2 , Is tolerable, And then we Dp , F [I] [j] [G] Indicates that (I, j) And the differentiation status is G Then we can pre-process (I, j) You can differentiate the pairs of matrices.
So the final answer is F [N] [M] [2 K? (K? 1) 2? 1] .
AC code:
#include
#include
#include
#include
#include #include
using namespace std;int N,M;int K;int ch[10][20][20]={{{0}}};int change[20][20]={{0}};int F[33000]={0};bool Matrix[33000][11][11]={{{0}}};int need[20][20]={{0}};int main(){ scanf("%d%d%d",&N,&M,&K); for(int i=1;i<=K;i++) for(int p=1;p<=N;p++) for(int q=1;q<=M;q++) { scanf("%1d",&ch[i][p][q]); for(int j=1;j
=0;p--) { if(change[i][j]==0) continue; if(F[p]+1