void GetAns()
{
     tops = 0;
     memset( lens, 0, sizeof( lens ) );
     memset( ds, 0, sizeof( ds ) );
     l = 0;
     BuildTrees( 0, s );
     topt = 0;
     memset( lent, 0, sizeof( lent ) );
     memset( dt, 0, sizeof( dt ) );
     l = 0;
     BuildTreet( 0, t );
    
     ReBuilds( 0 );
     ReBuildt( 0 );
     memset( flag, 0, sizeof( flag ) );
     tops = 0;
     DFSS(0);
     ps[tops] = 0;
     topt = 0;
     memset( flag, 0, sizeof( flag ) );
     DFST(0);
     pt[topt] = 0;
     if( strcmp( ps, pt ) == 0 )printf( "same\n" );
     else printf( "different\n" );
    
}
Beispiel #2
0
TVector<TMxTree> BuildMatrixnetTrees(const TFullModel& model, TVector<TFeature>* features) {
    THashMap<TFeature, int, TFeatureHash> featureToIdx;
    const auto& modelBinFeatures = model.ObliviousTrees.GetBinFeatures();
    for (auto binSplit : model.ObliviousTrees.TreeSplits) {
        TFeature feature = GetFeature(modelBinFeatures[binSplit]);
        if (featureToIdx.has(feature)) {
            continue;
        }
        int featureIdx = featureToIdx.ysize();
        featureToIdx[feature] = featureIdx;
        features->push_back(feature);
    }

    return BuildTrees(featureToIdx, model);
}
void BuildTrees( int u, char *s )
{
     if( s[l] == 0 )return;
    
     while( s[l] && s[l] == '0' )
     {
         trees[u][lens[u]++] = ++tops;
         l++;
         ds[u]++;
         BuildTrees( tops, s );
         if( s[l] == 0 )return;
     }
     if( s[l] == 0 )return;
     l++;
     return;
}