QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#480648#144. Primitive root / 原根WrongAnswer_90#10 ✓546ms4140kbC++204.9kb2024-07-16 17:06:092024-07-16 17:06:09

Judging History

你现在查看的是最新测评结果

  • [2024-07-16 17:06:09]
  • 评测
  • 测评结果:10
  • 用时:546ms
  • 内存:4140kb
  • [2024-07-16 17:06:09]
  • 提交

answer

#include<bits/stdc++.h>
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define ll long long
#define lll __int128
#define fi first
#define se second
#define e emplace
#define eb emplace_back
#define db double
#define ef emplace_front
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vp vector<pii>
#define mp make_pair

//#define LOCALJUDGE
 #define int __int128
bool ST;
static const ll MOD=998244353,Phi=998244352,inv2=499122177,Root=3,iRoot=332748118;
static const ll inf=1073741823,INF=4557430888798830399;
static const ld eps=1e-9,pi=3.1415926535;
char in[1<<20],*p1=in,*p2=in;
using namespace std;
//#define getchar() (p1==p2&&(p2=(p1=in)+fread(in,1,1<<20,stdin),p1==p2)?EOF:*p1++)
struct tup{int x,y,z;tup(int X=0,int Y=0,int Z=0){x=X,y=Y,z=Z;}};
namespace FastIO
{
	template<typename T> inline void write(T x,char ch=' ')
	{
		if(is_same<char,T>::value)putchar(x);
		else
		{
			if(x<0)x=-x,putchar('-');
			static char st[25];int top=0;
			do{st[top++]=x%10+'0',x/=10;}while(x);
			while(top)putchar(st[--top]);
		}
		ch!='~'?putchar(ch):0;
	}
	inline void write(const char*x,char ch=' ')
	{
		for(int i=0;x[i]!='\0';++i)putchar(x[i]);
		ch!='~'?putchar(ch):0;
	}
	inline void read(char&s){do s=getchar();while(s=='\n'||s==' ');}
	inline void read(char s[])
	{
		int len=0;char st;
		do st=getchar();while(st=='\n'||st==' ');
		s[++len]=st,st=getchar();
		while(st!='\n'&&st!=' ')s[++len]=st,st=getchar();
		s[++len]='\0';
	}
	template<typename T> inline void read(T &s)
	{
		
		s=0;char ch=getchar();
		while((ch>'9'||ch<'0')&&ch!='-')ch=getchar();
		bool tf=(ch=='-')&&(ch=getchar());
		while((ch>='0')&&(ch<='9'))s=(s<<1)+(s<<3)+ch-'0',ch=getchar();
		s=(tf?-s:s);
	}
	template<typename T1,typename T2> inline void read(pair<T1,T2> &s){read(s.fi),read(s.se);}
	template<typename T,typename...Args> inline void write(T x,Args...args){write(x,'~'),write(args...);}
	template<typename T,typename...Args> inline void read(T&x,Args&...args){read(x),read(args...);}
}	
using namespace FastIO;
namespace MTool
{
	inline int Cadd(int a,int b){return (ll)a+b>=MOD?(ll)a+b-MOD:a+b;}
	inline int Cdel(int a,int b){return a-b<0?a-b+MOD:a-b;}
	inline int Cmul(int a,int b){return 1ll*a*b%MOD;}
	inline int sqr(int a){return 1ll*a*a%MOD;}
	inline void Madd(int&a,int b){a=((ll)a+b>=MOD?(ll)a+b-MOD:a+b);}
	inline void Mdel(int&a,int b){a=(a-b<0?a-b+MOD:a-b);}
	inline void Mmul(int&a,int b){a=1ll*a*b%MOD;}
	template<typename T> inline bool Mmax(T&a,T b){return a<b?a=b,1:0;}
	template<typename T> inline bool Mmin(T&a,T b){return a>b?a=b,1:0;}
	template<typename...Args> inline void Madd(int&a,int b,Args...args){Madd(a,b),Madd(a,args...);}
	template<typename...Args> inline void Mmul(int&a,int b,Args...args){Mmul(a,b),Mmul(a,args...);}
	template<typename...Args> inline void Mdel(int&a,int b,Args...args){Mdel(a,b),Mdel(a,args...);}
	template<typename...Args> inline int Cadd(int a,int b,Args...args){return Cadd(Cadd(a,b),args...);}
	template<typename...Args> inline int Cmul(int a,int b,Args...args){return Cmul(Cmul(a,b),args...);}
	template<typename...Args> inline int Cdel(int a,int b,Args...args){return Cdel(Cdel(a,b),args...);}
	template<typename...Args,typename T> inline bool Mmax(T&a,T b,Args...args){return Mmax(a,b)|Mmax(a,args...);}
	template<typename...Args,typename T> inline bool Mmin(T&a,T b,Args...args){return Mmin(a,b)|Mmin(a,args...);}
//	inline int power(int x,int y){int s=1;for(;y;y>>=1,Mmul(x,x))if(y&1)Mmul(s,x);return s;}
}
using namespace MTool;
namespace WrongAnswer_90
{
	int n;
	inline int power(int x,int y,int z)
	{
		int s=1;
		for(;y;y>>=1,x=(__int128)x*x%z)if(y&1)s=(__int128)s*x%z;
		return s;
	}
	int phi(int x)
	{
		int s=1;
		for(int i=2;i*i<=x;++i)
		{
			if(x%i==0)
			{
				s*=i-1,x/=i;
				while(x%i==0)s*=i,x/=i;
			}
		}
		if(x!=1)s*=x-1;
		return s;
	}
	vi ve;
	inline void mian()
	{
		read(n);int nn=n;
		if(n==2)return write(1);
		if(n==4)return write(3);
//		assert(n!=1); 
		if(n==1)return write(-1);
		if(n%4==0)return write(-1);
		if(n%2==0)nn/=2;
		for(int i=3;i*i<=nn;++i)
		{
			if(nn%i==0)
			{
				while(nn%i==0)nn/=i;
				if(nn!=1)return write(-1);
			}
		}
		int m=phi(n),mm=m;
		for(int i=2;i*i<=m;++i)
		{
			if(m%i==0)ve.eb(i);
			while(m%i==0)m/=i;
		}
		if(m>1)ve.eb(m);
		m=mm;
		for(int i=2;;++i)
		{
			int fl=1;
			if(__gcd(i,n)!=1)continue;
			for(auto p:ve)fl&=power(i,m/p,n)!=1;
			if(fl)return write(i);
		}
		assert(0);
	}
}
bool ED;
signed main()
{
//	#ifdef LOCALJUDGE
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
//	#endif
	double st=clock();
	WrongAnswer_90::mian();
	double ed=clock();
	#ifndef LOCALJUDGE
 	cerr<<endl;
	#endif
 	cerr<<"Time: "<<ed-st<<" ms\n";
	#ifdef LOCALJUDGE
 	cerr<<"     ";
	#endif
 	cerr<<"Memory: "<<abs(&ST-&ED)/1024.0/1024.0<<" MB\n";
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 0ms
memory: 3832kb

input:

433

output:

5 

result:

ok good solution

Test #2:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

197

output:

2 

result:

ok good solution

Test #3:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

733

output:

6 

result:

ok good solution

Test #4:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

859

output:

2 

result:

ok good solution

Test #5:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

449

output:

3 

result:

ok good solution

Test #6:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

263

output:

5 

result:

ok good solution

Test #7:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

683

output:

5 

result:

ok good solution

Test #8:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

17

output:

3 

result:

ok good solution

Test #9:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

359

output:

7 

result:

ok good solution

Test #10:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

89

output:

3 

result:

ok good solution

Test #11:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

647

output:

5 

result:

ok good solution

Test #12:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

487

output:

3 

result:

ok good solution

Test #13:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

677

output:

2 

result:

ok good solution

Test #14:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

829

output:

2 

result:

ok good solution

Test #15:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

227

output:

2 

result:

ok good solution

Test #16:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

151

output:

6 

result:

ok good solution

Test #17:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

607

output:

3 

result:

ok good solution

Test #18:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

661

output:

2 

result:

ok good solution

Test #19:

score: 0
Accepted
time: 0ms
memory: 4028kb

input:

151

output:

6 

result:

ok good solution

Test #20:

score: 0
Accepted
time: 0ms
memory: 3992kb

input:

101

output:

2 

result:

ok good solution

Test #21:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

5

output:

2 

result:

ok good solution

Test #22:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

877

output:

2 

result:

ok good solution

Test #23:

score: 0
Accepted
time: 0ms
memory: 4120kb

input:

139

output:

2 

result:

ok good solution

Test #24:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

389

output:

2 

result:

ok good solution

Test #25:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

421

output:

2 

result:

ok good solution

Test #26:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

709

output:

2 

result:

ok good solution

Test #27:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

331

output:

3 

result:

ok good solution

Test #28:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

269

output:

2 

result:

ok good solution

Test #29:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

797

output:

2 

result:

ok good solution

Test #30:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

997

output:

7 

result:

ok good solution

Subtask #2:

score: 1
Accepted

Dependency #1:

100%
Accepted

Test #31:

score: 1
Accepted
time: 0ms
memory: 3992kb

input:

841

output:

2 

result:

ok good solution

Test #32:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

289

output:

3 

result:

ok good solution

Test #33:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

729

output:

2 

result:

ok good solution

Test #34:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

169

output:

2 

result:

ok good solution

Test #35:

score: 0
Accepted
time: 0ms
memory: 4060kb

input:

961

output:

3 

result:

ok good solution

Test #36:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

31

output:

3 

result:

ok good solution

Test #37:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

243

output:

2 

result:

ok good solution

Test #38:

score: 0
Accepted
time: 0ms
memory: 4120kb

input:

625

output:

2 

result:

ok good solution

Test #39:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

121

output:

2 

result:

ok good solution

Test #40:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

125

output:

2 

result:

ok good solution

Test #41:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

512

output:

-1 

result:

ok no solution

Test #42:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

361

output:

2 

result:

ok good solution

Test #43:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

529

output:

5 

result:

ok good solution

Test #44:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

29

output:

2 

result:

ok good solution

Test #45:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

23

output:

5 

result:

ok good solution

Test #46:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

11

output:

2 

result:

ok good solution

Test #47:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

25

output:

2 

result:

ok good solution

Test #48:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

13

output:

2 

result:

ok good solution

Test #49:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

19

output:

2 

result:

ok good solution

Test #50:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

5

output:

2 

result:

ok good solution

Test #51:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

17

output:

3 

result:

ok good solution

Test #52:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

343

output:

3 

result:

ok good solution

Test #53:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

81

output:

2 

result:

ok good solution

Test #54:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

27

output:

2 

result:

ok good solution

Test #55:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

256

output:

-1 

result:

ok no solution

Test #56:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

49

output:

3 

result:

ok good solution

Test #57:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

9

output:

2 

result:

ok good solution

Test #58:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

3

output:

2 

result:

ok good solution

Test #59:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

7

output:

3 

result:

ok good solution

Test #60:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

128

output:

-1 

result:

ok no solution

Subtask #3:

score: 1
Accepted

Dependency #2:

100%
Accepted

Test #61:

score: 1
Accepted
time: 0ms
memory: 3956kb

input:

578

output:

3 

result:

ok good solution

Test #62:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

686

output:

3 

result:

ok good solution

Test #63:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

242

output:

7 

result:

ok good solution

Test #64:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

722

output:

3 

result:

ok good solution

Test #65:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

236

output:

-1 

result:

ok no solution

Test #66:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

486

output:

5 

result:

ok good solution

Test #67:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

250

output:

3 

result:

ok good solution

Test #68:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

98

output:

3 

result:

ok good solution

Test #69:

score: 0
Accepted
time: 0ms
memory: 4140kb

input:

162

output:

5 

result:

ok good solution

Test #70:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

770

output:

-1 

result:

ok no solution

Test #71:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

14

output:

3 

result:

ok good solution

Test #72:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

54

output:

5 

result:

ok good solution

Test #73:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

22

output:

7 

result:

ok good solution

Test #74:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

512

output:

-1 

result:

ok no solution

Test #75:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

284

output:

-1 

result:

ok no solution

Test #76:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

50

output:

3 

result:

ok good solution

Test #77:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

34

output:

3 

result:

ok good solution

Test #78:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

38

output:

3 

result:

ok good solution

Test #79:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

338

output:

7 

result:

ok good solution

Test #80:

score: 0
Accepted
time: 0ms
memory: 4060kb

input:

37

output:

2 

result:

ok good solution

Test #81:

score: 0
Accepted
time: 0ms
memory: 4028kb

input:

10

output:

3 

result:

ok good solution

Test #82:

score: 0
Accepted
time: 0ms
memory: 4120kb

input:

26

output:

7 

result:

ok good solution

Test #83:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

256

output:

-1 

result:

ok no solution

Test #84:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

18

output:

5 

result:

ok good solution

Test #85:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

881

output:

3 

result:

ok good solution

Test #86:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

128

output:

-1 

result:

ok no solution

Test #87:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

64

output:

-1 

result:

ok no solution

Test #88:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

32

output:

-1 

result:

ok no solution

Test #89:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

6

output:

5 

result:

ok good solution

Test #90:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

257

output:

3 

result:

ok good solution

Subtask #4:

score: 1
Accepted

Dependency #1:

100%
Accepted

Test #91:

score: 1
Accepted
time: 0ms
memory: 4052kb

input:

182233

output:

5 

result:

ok good solution

Test #92:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

28771

output:

2 

result:

ok good solution

Test #93:

score: 0
Accepted
time: 0ms
memory: 4028kb

input:

579239

output:

11 

result:

ok good solution

Test #94:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

724747

output:

7 

result:

ok good solution

Test #95:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

143513

output:

3 

result:

ok good solution

Test #96:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

695509

output:

2 

result:

ok good solution

Test #97:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

999217

output:

5 

result:

ok good solution

Test #98:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

888161

output:

3 

result:

ok good solution

Test #99:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

234287

output:

5 

result:

ok good solution

Test #100:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

746483

output:

2 

result:

ok good solution

Test #101:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

985003

output:

3 

result:

ok good solution

Test #102:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

786959

output:

17 

result:

ok good solution

Test #103:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

1097

output:

3 

result:

ok good solution

Test #104:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

105527

output:

5 

result:

ok good solution

Test #105:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

812519

output:

7 

result:

ok good solution

Test #106:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

161599

output:

6 

result:

ok good solution

Test #107:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

645131

output:

2 

result:

ok good solution

Test #108:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

63397

output:

2 

result:

ok good solution

Test #109:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

244429

output:

6 

result:

ok good solution

Test #110:

score: 0
Accepted
time: 0ms
memory: 4028kb

input:

911453

output:

2 

result:

ok good solution

Test #111:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

340477

output:

2 

result:

ok good solution

Test #112:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

28351

output:

6 

result:

ok good solution

Test #113:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

414277

output:

2 

result:

ok good solution

Test #114:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

411923

output:

2 

result:

ok good solution

Test #115:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

986281

output:

19 

result:

ok good solution

Test #116:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

882047

output:

5 

result:

ok good solution

Test #117:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

323009

output:

3 

result:

ok good solution

Test #118:

score: 0
Accepted
time: 0ms
memory: 4120kb

input:

577153

output:

5 

result:

ok good solution

Test #119:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

42281

output:

11 

result:

ok good solution

Test #120:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

601823

output:

5 

result:

ok good solution

Subtask #5:

score: 1
Accepted

Dependency #2:

100%
Accepted

Dependency #4:

100%
Accepted

Test #121:

score: 1
Accepted
time: 0ms
memory: 3964kb

input:

531441

output:

2 

result:

ok good solution

Test #122:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

703921

output:

11 

result:

ok good solution

Test #123:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

253009

output:

5 

result:

ok good solution

Test #124:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

229441

output:

13 

result:

ok good solution

Test #125:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

22801

output:

6 

result:

ok good solution

Test #126:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

160801

output:

3 

result:

ok good solution

Test #127:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

477481

output:

3 

result:

ok good solution

Test #128:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

177147

output:

2 

result:

ok good solution

Test #129:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

120409

output:

2 

result:

ok good solution

Test #130:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

185761

output:

7 

result:

ok good solution

Test #131:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

357911

output:

7 

result:

ok good solution

Test #132:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

358801

output:

7 

result:

ok good solution

Test #133:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

143641

output:

2 

result:

ok good solution

Test #134:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

727609

output:

2 

result:

ok good solution

Test #135:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

192721

output:

15 

result:

ok good solution

Test #136:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

201601

output:

3 

result:

ok good solution

Test #137:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

310249

output:

2 

result:

ok good solution

Test #138:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

124609

output:

3 

result:

ok good solution

Test #139:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

52441

output:

6 

result:

ok good solution

Test #140:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

299209

output:

2 

result:

ok good solution

Test #141:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

524288

output:

-1 

result:

ok no solution

Test #142:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

564001

output:

3 

result:

ok good solution

Test #143:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

704969

output:

3 

result:

ok good solution

Test #144:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

58081

output:

7 

result:

ok good solution

Test #145:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

375769

output:

2 

result:

ok good solution

Test #146:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

853

output:

2 

result:

ok good solution

Test #147:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

37249

output:

5 

result:

ok good solution

Test #148:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

389017

output:

5 

result:

ok good solution

Test #149:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

516961

output:

11 

result:

ok good solution

Test #150:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

677329

output:

3 

result:

ok good solution

Subtask #6:

score: 1
Accepted

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Test #151:

score: 1
Accepted
time: 0ms
memory: 3960kb

input:

334562

output:

21 

result:

ok good solution

Test #152:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

138338

output:

5 

result:

ok good solution

Test #153:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

37538

output:

3 

result:

ok good solution

Test #154:

score: 0
Accepted
time: 0ms
memory: 4028kb

input:

144722

output:

3 

result:

ok good solution

Test #155:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

938250

output:

-1 

result:

ok no solution

Test #156:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

722402

output:

7 

result:

ok good solution

Test #157:

score: 0
Accepted
time: 0ms
memory: 4012kb

input:

278258

output:

5 

result:

ok good solution

Test #158:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

826898

output:

11 

result:

ok good solution

Test #159:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

287282

output:

3 

result:

ok good solution

Test #160:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

697837

output:

-1 

result:

ok no solution

Test #161:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

108578

output:

3 

result:

ok good solution

Test #162:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

354482

output:

23 

result:

ok good solution

Test #163:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

547058

output:

5 

result:

ok good solution

Test #164:

score: 0
Accepted
time: 1ms
memory: 3960kb

input:

1286

output:

11 

result:

ok good solution

Test #165:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

247417

output:

-1 

result:

ok no solution

Test #166:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

293378

output:

5 

result:

ok good solution

Test #167:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

227138

output:

15 

result:

ok good solution

Test #168:

score: 0
Accepted
time: 0ms
memory: 3992kb

input:

736898

output:

3 

result:

ok good solution

Test #169:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

954962

output:

3 

result:

ok good solution

Test #170:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

535022

output:

3 

result:

ok good solution

Test #171:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

49298

output:

5 

result:

ok good solution

Test #172:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

171698

output:

3 

result:

ok good solution

Test #173:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

717602

output:

7 

result:

ok good solution

Test #174:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

482162

output:

7 

result:

ok good solution

Test #175:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

313737

output:

-1 

result:

ok no solution

Test #176:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

23762

output:

11 

result:

ok good solution

Test #177:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

674

output:

15 

result:

ok good solution

Test #178:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

157922

output:

3 

result:

ok good solution

Test #179:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

585362

output:

13 

result:

ok good solution

Test #180:

score: 0
Accepted
time: 0ms
memory: 3944kb

input:

391017

output:

-1 

result:

ok no solution

Subtask #7:

score: 1
Accepted

Dependency #4:

100%
Accepted

Test #181:

score: 1
Accepted
time: 1ms
memory: 3936kb

input:

842797909

output:

2 

result:

ok good solution

Test #182:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

662460749

output:

2 

result:

ok good solution

Test #183:

score: 0
Accepted
time: 1ms
memory: 3900kb

input:

583578713

output:

3 

result:

ok good solution

Test #184:

score: 0
Accepted
time: 1ms
memory: 4120kb

input:

714745777

output:

19 

result:

ok good solution

Test #185:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

626528689

output:

7 

result:

ok good solution

Test #186:

score: 0
Accepted
time: 1ms
memory: 4008kb

input:

848747719

output:

3 

result:

ok good solution

Test #187:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

780868019

output:

2 

result:

ok good solution

Test #188:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

295695817

output:

5 

result:

ok good solution

Test #189:

score: 0
Accepted
time: 1ms
memory: 4028kb

input:

950964661

output:

6 

result:

ok good solution

Test #190:

score: 0
Accepted
time: 0ms
memory: 4028kb

input:

219526067

output:

2 

result:

ok good solution

Test #191:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

763440683

output:

2 

result:

ok good solution

Test #192:

score: 0
Accepted
time: 1ms
memory: 3988kb

input:

744457559

output:

43 

result:

ok good solution

Test #193:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

117979097

output:

3 

result:

ok good solution

Test #194:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

910461493

output:

5 

result:

ok good solution

Test #195:

score: 0
Accepted
time: 1ms
memory: 4052kb

input:

796412147

output:

2 

result:

ok good solution

Test #196:

score: 0
Accepted
time: 1ms
memory: 3928kb

input:

221019493

output:

2 

result:

ok good solution

Test #197:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

237830497

output:

10 

result:

ok good solution

Test #198:

score: 0
Accepted
time: 1ms
memory: 3912kb

input:

209079863

output:

5 

result:

ok good solution

Test #199:

score: 0
Accepted
time: 1ms
memory: 3956kb

input:

808345841

output:

3 

result:

ok good solution

Test #200:

score: 0
Accepted
time: 0ms
memory: 3944kb

input:

100217503

output:

3 

result:

ok good solution

Test #201:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

99546341

output:

2 

result:

ok good solution

Test #202:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

811108069

output:

6 

result:

ok good solution

Test #203:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

121875503

output:

5 

result:

ok good solution

Test #204:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

932569537

output:

10 

result:

ok good solution

Test #205:

score: 0
Accepted
time: 1ms
memory: 4024kb

input:

598983901

output:

6 

result:

ok good solution

Test #206:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

54645551

output:

7 

result:

ok good solution

Test #207:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

22252519

output:

3 

result:

ok good solution

Test #208:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

666436031

output:

14 

result:

ok good solution

Test #209:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

900871603

output:

2 

result:

ok good solution

Test #210:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

561111223

output:

43 

result:

ok good solution

Subtask #8:

score: 1
Accepted

Dependency #5:

100%
Accepted

Dependency #7:

100%
Accepted

Test #211:

score: 1
Accepted
time: 0ms
memory: 3952kb

input:

65983129

output:

2 

result:

ok good solution

Test #212:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

29626249

output:

2 

result:

ok good solution

Test #213:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

25210441

output:

3 

result:

ok good solution

Test #214:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

632673409

output:

10 

result:

ok good solution

Test #215:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

150528361

output:

2 

result:

ok good solution

Test #216:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

68417929

output:

21 

result:

ok good solution

Test #217:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

106357969

output:

3 

result:

ok good solution

Test #218:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

4068289

output:

5 

result:

ok good solution

Test #219:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

43309561

output:

14 

result:

ok good solution

Test #220:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

668170801

output:

7 

result:

ok good solution

Test #221:

score: 0
Accepted
time: 1ms
memory: 4060kb

input:

339038569

output:

2 

result:

ok good solution

Test #222:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

522625321

output:

2 

result:

ok good solution

Test #223:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

127938721

output:

3 

result:

ok good solution

Test #224:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

41306329

output:

3 

result:

ok good solution

Test #225:

score: 0
Accepted
time: 1ms
memory: 3884kb

input:

259564321

output:

7 

result:

ok good solution

Test #226:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

13997521

output:

7 

result:

ok good solution

Test #227:

score: 0
Accepted
time: 1ms
memory: 3956kb

input:

400920529

output:

3 

result:

ok good solution

Test #228:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

119880601

output:

2 

result:

ok good solution

Test #229:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

383493889

output:

5 

result:

ok good solution

Test #230:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

122257249

output:

3 

result:

ok good solution

Test #231:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

633579241

output:

3 

result:

ok good solution

Test #232:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

53743561

output:

2 

result:

ok good solution

Test #233:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

481231969

output:

7 

result:

ok good solution

Test #234:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

462379009

output:

5 

result:

ok good solution

Test #235:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

1957201

output:

13 

result:

ok good solution

Test #236:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

196308121

output:

2 

result:

ok good solution

Test #237:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

300017041

output:

3 

result:

ok good solution

Test #238:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

414244609

output:

5 

result:

ok good solution

Test #239:

score: 0
Accepted
time: 0ms
memory: 4064kb

input:

533411731

output:

3 

result:

ok good solution

Test #240:

score: 0
Accepted
time: 1ms
memory: 3992kb

input:

529138009

output:

2 

result:

ok good solution

Subtask #9:

score: 1
Accepted

Dependency #6:

100%
Accepted

Dependency #8:

100%
Accepted

Test #241:

score: 1
Accepted
time: 0ms
memory: 3836kb

input:

367367618

output:

3 

result:

ok good solution

Test #242:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

489657218

output:

5 

result:

ok good solution

Test #243:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

499469618

output:

5 

result:

ok good solution

Test #244:

score: 0
Accepted
time: 0ms
memory: 4124kb

input:

24907682

output:

17 

result:

ok good solution

Test #245:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

490448845

output:

-1 

result:

ok no solution

Test #246:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

406068002

output:

3 

result:

ok good solution

Test #247:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

219804478

output:

13 

result:

ok good solution

Test #248:

score: 0
Accepted
time: 0ms
memory: 4060kb

input:

405726098

output:

5 

result:

ok good solution

Test #249:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

474381602

output:

15 

result:

ok good solution

Test #250:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

246521126

output:

-1 

result:

ok no solution

Test #251:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

111930722

output:

7 

result:

ok good solution

Test #252:

score: 0
Accepted
time: 1ms
memory: 4124kb

input:

472904258

output:

3 

result:

ok good solution

Test #253:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

543642338

output:

5 

result:

ok good solution

Test #254:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

610891058

output:

3 

result:

ok good solution

Test #255:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

489880646

output:

-1 

result:

ok no solution

Test #256:

score: 0
Accepted
time: 0ms
memory: 4020kb

input:

190086002

output:

3 

result:

ok good solution

Test #257:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

541007618

output:

3 

result:

ok good solution

Test #258:

score: 0
Accepted
time: 1ms
memory: 3920kb

input:

945168242

output:

3 

result:

ok good solution

Test #259:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

577116338

output:

3 

result:

ok good solution

Test #260:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

135176072

output:

-1 

result:

ok no solution

Test #261:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

7136642

output:

3 

result:

ok good solution

Test #262:

score: 0
Accepted
time: 1ms
memory: 4112kb

input:

690953138

output:

5 

result:

ok good solution

Test #263:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

15691202

output:

3 

result:

ok good solution

Test #264:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

8661122

output:

3 

result:

ok good solution

Test #265:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

969491343

output:

-1 

result:

ok no solution

Test #266:

score: 0
Accepted
time: 0ms
memory: 3988kb

input:

172273922

output:

3 

result:

ok good solution

Test #267:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

40374098

output:

3 

result:

ok good solution

Test #268:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

111213698

output:

3 

result:

ok good solution

Test #269:

score: 0
Accepted
time: 0ms
memory: 4116kb

input:

535495538

output:

3 

result:

ok good solution

Test #270:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

715962635

output:

-1 

result:

ok no solution

Subtask #10:

score: 1
Accepted

Dependency #9:

100%
Accepted

Test #271:

score: 1
Accepted
time: 297ms
memory: 3904kb

input:

2670238111993922

output:

31 

result:

ok good solution

Test #272:

score: 0
Accepted
time: 216ms
memory: 4056kb

input:

1412768792638898

output:

3 

result:

ok good solution

Test #273:

score: 0
Accepted
time: 334ms
memory: 3956kb

input:

3415757055522338

output:

5 

result:

ok good solution

Test #274:

score: 0
Accepted
time: 143ms
memory: 3844kb

input:

609849802971602

output:

7 

result:

ok good solution

Test #275:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

2470756780761188

output:

-1 

result:

ok no solution

Test #276:

score: 0
Accepted
time: 384ms
memory: 3832kb

input:

4540448632181282

output:

33 

result:

ok good solution

Test #277:

score: 0
Accepted
time: 267ms
memory: 3956kb

input:

2191832922455282

output:

7 

result:

ok good solution

Test #278:

score: 0
Accepted
time: 492ms
memory: 4056kb

input:

7397519340340082

output:

11 

result:

ok good solution

Test #279:

score: 0
Accepted
time: 272ms
memory: 3836kb

input:

2243715766515218

output:

5 

result:

ok good solution

Test #280:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

2212319589622572

output:

-1 

result:

ok no solution

Test #281:

score: 0
Accepted
time: 274ms
memory: 3988kb

input:

2296554929310098

output:

3 

result:

ok good solution

Test #282:

score: 0
Accepted
time: 527ms
memory: 3844kb

input:

8659147610906018

output:

3 

result:

ok good solution

Test #283:

score: 0
Accepted
time: 93ms
memory: 3928kb

input:

258429609036722

output:

15 

result:

ok good solution

Test #284:

score: 0
Accepted
time: 515ms
memory: 4056kb

input:

7638862917598802

output:

11 

result:

ok good solution

Test #285:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

8275064231348893

output:

-1 

result:

ok no solution

Test #286:

score: 0
Accepted
time: 382ms
memory: 3900kb

input:

4531313037563138

output:

7 

result:

ok good solution

Test #287:

score: 0
Accepted
time: 334ms
memory: 3944kb

input:

3403611272369618

output:

7 

result:

ok good solution

Test #288:

score: 0
Accepted
time: 279ms
memory: 3824kb

input:

2379814327381922

output:

7 

result:

ok good solution

Test #289:

score: 0
Accepted
time: 546ms
memory: 4052kb

input:

9150661439796962

output:

7 

result:

ok good solution

Test #290:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

4663789583183194

output:

-1 

result:

ok no solution

Test #291:

score: 0
Accepted
time: 2ms
memory: 3884kb

input:

115014794498

output:

5 

result:

ok good solution

Test #292:

score: 0
Accepted
time: 182ms
memory: 3952kb

input:

1011914274734162

output:

3 

result:

ok good solution

Test #293:

score: 0
Accepted
time: 483ms
memory: 3880kb

input:

6273881517086402

output:

3 

result:

ok good solution

Test #294:

score: 0
Accepted
time: 535ms
memory: 4116kb

input:

8837771746078802

output:

3 

result:

ok good solution

Test #295:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

2748517911524984

output:

-1 

result:

ok no solution

Test #296:

score: 0
Accepted
time: 71ms
memory: 3952kb

input:

153116285124002

output:

19 

result:

ok good solution

Test #297:

score: 0
Accepted
time: 152ms
memory: 4112kb

input:

676295415993698

output:

3 

result:

ok good solution

Test #298:

score: 0
Accepted
time: 475ms
memory: 3844kb

input:

4859597134764338

output:

5 

result:

ok good solution

Test #299:

score: 0
Accepted
time: 48ms
memory: 3888kb

input:

70865774435618

output:

11 

result:

ok good solution

Test #300:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

1639197169

output:

10 

result:

ok good solution