Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <vector>
- #include <queue>
- #include <set>
- #include <map>
- #include <cstdio>
- #include <cstdlib>
- #include <cctype>
- #include <cmath>
- #include <cstring>
- #include <ctime>
- #include <cassert>
- using namespace std;
- typedef unsigned long long LL;
- #define FOR(k,a,b) for(LL k(a); k < (b); ++k)
- #define FORD(k,a,b) for(int k(b-1); k >= (a); --k)
- #define REP(k,a) for(int k=0; k < (a); ++k)
- #define ABS(a) ((a)>0?(a):-(a))
- #ifdef HOME
- #include "debug.h"
- #else
- #define debug(args...)
- #endif
- void print_factor(int a)
- {
- bool started=false;
- for(int i=2;i*i<=a;++i)
- {
- while(!(a%i))
- {
- if(started)
- cerr << "*" << i ;
- else
- cerr << i;
- a/=i;
- started=true;
- }
- }
- if(a>1)
- {
- if(started)
- cerr << "*" << a ;
- else
- cerr << a;
- }
- }
- bool is_prime(int a)
- {
- for(int i=2;i*i<=a;++i)
- {
- if(!(a%i))
- {
- return false;
- }
- }
- return true;
- }
- int main()
- {
- #ifdef HOME
- clock_t start=clock();
- freopen ("in.txt","r",stdin);
- freopen ("out.txt","w",stdout);
- freopen ("out_err.txt","w",stderr);
- #endif
- int T,N;
- scanf("%d",&T);
- const int nmax=100005;
- const int as=26;
- const LL mod=1e9+7;
- vector<bool> used(nmax);
- list<int> l;
- N=0;
- map<int,int> m;
- map<pair<int,int>,vector<int> > m2;
- T=600;
- REP(testcase,T)
- {
- //scanf("%d",&N);
- m.clear();
- N+=2;
- used.clear();
- used.resize(N);
- LL res=1;
- cerr << "--------------------\n" ;
- cerr << "N:" << N << "=";
- print_factor(N);
- cerr << endl;
- REP(i,N)
- {
- if(!used[i])
- {
- l.clear();
- res*=as;
- res%=mod;
- int act=i%2?i/2:N/2+i/2;
- used[act]=true;
- if((act+1)%2)
- l.push_back(act+1);
- else
- l.push_back(act+1);
- while(act!=i)
- {
- act=act%2?act/2:N/2+act/2;
- if((act+1)%2)
- l.push_back(act+1);
- else
- l.push_back(act+1);
- used[act]=true;
- }
- m[l.size()]++;
- debug(l);
- }
- }
- map<int,int>::iterator it=m.begin();
- printf("--------------------\n");
- printf("N:%d\n",N);
- for(;it!=m.end();++it)
- {
- printf("%d : %d db\n",it->first,it->second);
- m2[make_pair(it->first,it->second)].push_back(N);
- }
- printf("--------------------\n");
- //printf("%lld\n",res);
- }
- map<pair<int,int>,vector<int> >::iterator it=m2.begin();
- printf("--------------------\n");
- for(;it!=m2.end();++it)
- {
- if(is_prime(it->first.first))
- {
- printf("--------------------\n");
- printf("(%d , %d ) : ",it->first.first,it->first.second);
- vector<int>& w=it->second;
- REP(ii,w.size())
- {
- printf(" %d ",w[ii]);
- }
- printf("\n");
- }
- }
- printf("--------------------\n");
- #ifdef HOME
- fprintf(stderr,"time=%.3lfsec\n",0.001*(clock()-start));
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment