Sgu-262 Symbol Recognition

Source: Internet
Author: User

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
        
       
      
     
    
   
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.