Exemple #1
0
void prime_sieve() {
    for ( int i = 3; i <= SQRP; i += 2 )
        if ( !IsComp(i) ) for ( int j = i*i; j <= MAXP; j+=i+i ) SetComp(j);
    primes.push_back ( 2 );
    for ( int i = 3; i <= MAXP; i += 2 ) if ( !IsComp(i) ) primes.push_back ( i );
}
Exemple #2
0
 Set(int n) { for (int i=0; i <= n; ++i) s.push_back(i); }
Exemple #3
0
 SegTree(int N) : n(N) {
     A.resize(n); R.resize(n);
     int h = 1 + ceil(log2(n)); T.resize(1 << h); }
void dumpIV(const IV& X, const char* s) { 
  IVec V; V.copy(X.size(), X.data());
  V.print(g_MSGFile, s, "d",  0, 4, true); 
}