CF1137 C. Museums Tour

CF1137 C. Museums Tour

Generally the normal thinking: see point are reduced to the idea of the first graph (but to prove that an individual analysis of a wave of strong Unicom components can be put together into a whole, it is generally edges and vertices can then go through numerous contributions this type is only counted once) \ (the DAG \) above DP.

This question is too much trouble at first glance, because the time limit more disgusting look.

We consider the split point, a point will be split into \ (D \) a, \ ((I, J) \) represents the \ (I \) points at the \ (J \) Unicom situation days

In this case, we point reduction in the time, we have statistics about every component of a strong China Unicom how many points during the opening hours of the museum its corresponding ( pay attention to weight )

In this case, it looks like we got the strong point of the weight of each component of China Unicom

The remaining seemingly is a \ (DAG \) longest chain issues on the.

But we do not seem to consider the case of a point in two or more components of a strong China Unicom has contributed

Luckily it is not necessary to consider, because the above scenario is not possible

why?

We say that there is assumed such a path, to meet the \ ((i, x) - > (i, y) \) i.e. from \ (I \) point of \ (X \) days to reach the first \ (I \) th the first point \ (Y \) days, we set \ (\ of Delta D = Y - X \) (default \ (Y \) is greater than \ (X \) )

So there must be \ ((i, 0) - > (i, d - 1) \)

With such reminders, we found that from \ (y \) can also reach \ (the X-\) , then they will be in the same strong component Unicom

And ended

I stack with a variable deposit side of the array \ (tot \) leads to madness RE

#include<cstdio>
#include<cctype>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
//const int N = 7;
const int mod = 1e9 + 7;
int a[9],b[9];
int dp[2][131][131];
int p[9];
int c[31][9];
int noip[9];
//0 =
//1:>
int n,m;
int now = 1;
inline void up(int &x,int y){
    x += y;
    if(x >= mod) x -= mod;
}
int main(){
    p[0] = 1;
    for(int i = 1;i <= n;++i) up(p[i],p[i - 1] << 1);
    scanf("%d%d",&n,&m);
    if(n == 1){printf("%d\n",p[m]);return 0;}
    for(int i = 1;i <= n;++i) scanf("%d",&b[i]);
    for(int i = 0;i < m;++i)
        for(int j = 0;j < n;++j)
            z[i][j] = (b[j] & (1 << i)) ? 1 : 0;
    
//  for(int i = m;i >= 0;--i){
//      for(int l = 0;l < (1 << (n - 1));++l){
//          for(int r = 0;r < (1 << (n - 1));++r){
//              for(int s = 0;s < (1 << n);++s){
//                  
//              }
//          }
//      }
//  }
//0 =
//1:>
    int size1 = 1 << (n - 1);
    int size2 = size1 << 1;
    dp[0][0][0] = 1;
    for(int i = m - 1;i >= 0;i--){
        for(int l = 0;l < size1;++l){
            for(int r = 0;r < size1;++r){
                if(dp[now ^ 1][l][r] == 0) continue;
                for(int s = 0;s < n;++s) if()
            }
        }   
    }
    return 0;   
}

Guess you like

Origin www.cnblogs.com/wyxdrqc/p/10966766.html