QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#260329#5743. Palindromic PolynomialCrysflyWA 55ms4324kbC++174.5kb2023-11-22 01:33:222023-11-22 01:33:23

Judging History

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

  • [2023-11-22 01:33:23]
  • 评测
  • 测评结果:WA
  • 用时:55ms
  • 内存:4324kb
  • [2023-11-22 01:33:22]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define mod 1000000009
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
 
#define maxn 10005
#define inf 0x3f3f3f3f

int n,d;
modint x[maxn],y[maxn];
pair<modint,modint>tmp[maxn];
modint now[maxn];
int cnt;

modint f[maxn];
namespace F{

int l=0;
modint x[maxn],y[maxn],a[maxn];
int n;
void mul(modint b){
	++l,a[l]=0;
	Rep(i,l,1)a[i]=a[i]*b+a[i-1];
	a[0]*=b;
}
void div(modint b){
	modint iv=1/b;
	a[0]*=iv;
	For(i,1,l)a[i]-=a[i-1],a[i]*=iv;
	--l; 
}
void wk(){
	l=0,a[l]=1;
	memset(a,0,sizeof a);
	a[l]=1;
	memset(f,0,sizeof f);
//	For(i,1,n)cout<<x[i].x<<" "<<y[i].x<<"\n"; cout<<"----\n";
	For(i,1,n)mul(-x[i]);
	For(i,1,n){
		modint coef=1;
		For(j,1,n)if(i!=j)coef*=x[i]-x[j];
		coef=y[i]/coef;
		div(-x[i]);
		For(j,0,n-1)f[j]+=a[j]*coef;
		mul(-x[i]);
	}
//	For(i,0,n+1)cout<<f[i].x<<" ";cout<<"\n";
}

}

modint res[maxn],res2[maxn];

void work()
{
	n=read();
	For(i,1,n)x[i]=read();
	For(i,1,n)y[i]=read();
	For(i,1,n)For(j,i+1,n)
		if((x[i]*x[j]).x==1){
			if(y[i].x||y[j].x)
				tmp[++cnt]=mkp(x[i],y[i]/y[j]);
		}
	if(!cnt) d=n*2;
	else{
		d=-1;
		For(i,1,cnt)now[i]=1;
		For(i,0,10000){
			bool ok=1;
			For(j,1,cnt){
				if(now[j].x==tmp[j].se.x);
				else ok=0;
				now[j]*=tmp[j].fi;
			}
			if(ok){
			//	cout<<"ok "<<d<<"\n";
				d=i;
			//	break;
			}
		}
		if(d==-1)return puts("-1"),void();
	}
	cerr<<"D "<<d<<"\n";
	bool hav0=0;
	modint y0=1;
	map<modint,modint>mp;
	For(i,1,n){
		if(x[i].x==0){
			hav0=1;
			y0=y[i];
			if(!y0.x)return puts("-1"),void();
			continue;
		}
		mp[x[i]]=y[i];
		modint t=1/x[i];
	//	if(mp.count(t)) cerr<<"qwq "<<mp[t].x<<" "<<(y[i]*(x[i]^(mod-1-d))).x<<"\n";
		mp[1/x[i]]=y[i]*(x[i]^(mod-1-d));
	}
	
	F::n=0;
	for(auto it:mp) ++F::n,F::x[F::n]=it.fi,F::y[F::n]=it.se;
	F::wk();
	
	For(i,d+1,10000)
		if(f[i].x)return puts("-1"),void();
	For(i,0,d) res[i]=(f[i]+f[d-i])*((mod+1)/2);
//	For(i,0,d) cout<<res[i].x<<" "; cout<<"\n";
	if((hav0 && res[0].x!=y0.x) || (!hav0 && res[0].x==0)){
		modint add=y0-res[0];
		For(i,d+1,10000)
			if(F::a[i].x)return puts("-1"),void();
		For(i,0,d)
			res2[i]=(F::a[i]+F::a[d-i])*((mod+1)/2);
		add/=res2[0];
		For(i,0,d) res[i]+=res2[i]*add;
	}
	cout<<d<<"\n";
	For(i,0,d) cout<<res[i].x<<" "; cout<<"\n";
}

signed main()
{
	int T=read();
	while(T--)work();
    return 0;
}
/*

*/

详细

Test #1:

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

input:

8
2
0 1
2 4
3
0 1 2
2 10 36
4
0 1 2 3
1 4 9 16
5
0 1 2 3 4
1 25 961 14641 116281
2
2 500000005
5 375000004
2
2 500000005
5 375000004
2
2 500000005
1 2
3
2 500000005 3
5 375000004 10

output:

4
2 0 0 0 2 
6
2 499999992 250000023 499999994 250000023 499999992 2 
8
1 219444442 747685194 447222236 171296285 447222236 747685194 219444442 1 
10
1 220932529 904208073 568307571 27339787 558424139 27339787 568307571 904208073 220932529 1 
3
416666670 541666673 541666673 416666670 
3
416666670 54...

result:

ok OK (8 test cases)

Test #2:

score: 0
Accepted
time: 7ms
memory: 4048kb

input:

10
100
24820 26839 18512 6097 25046 22372 21548 2359 17721 9732 16436 12710 14995 4112 17855 28268 28129 13501 23470 16561 8633 29875 13119 10835 15842 14515 5588 10553 28603 3849 12379 17065 15155 15079 26029 3003 2878 29555 3609 8886 2841 17696 9648 4533 5924 12557 25988 29061 26075 28447 28620 20...

output:

200
1 586824842 23266180 435683114 91058397 298943272 757459418 18857042 34699348 620526775 849338772 5423434 801644207 115588806 691144185 511037804 964348631 249072606 508502941 498526761 581987409 423101177 580469478 550657602 966939015 863317819 511002171 862690372 836867991 40644476 377993764 9...

result:

ok OK (10 test cases)

Test #3:

score: 0
Accepted
time: 55ms
memory: 4300kb

input:

1
1000
112 16069 28329 8759 23521 1674 11755 9574 19846 5769 27729 17604 3648 29441 25349 24311 6088 2549 6437 16310 25464 25775 20988 21334 3451 1098 26971 3856 28015 24136 18147 24690 4690 4517 14412 29017 14675 5027 18071 4428 29328 28568 12161 2780 23653 21472 21227 23968 1331 24977 7243 13552 6...

output:

2000
1 353706879 795325438 697235506 233278975 896682394 110476938 12183459 816011576 393732880 184056411 679907175 917876032 289076038 393586357 805912301 909407616 823768971 143878524 237858547 88579280 959241762 511721569 349590016 13277413 531345095 16264092 578212732 182758412 548722701 4024217...

result:

ok OK (1 test case)

Test #4:

score: 0
Accepted
time: 6ms
memory: 4208kb

input:

21
8
1000000008 191950673 311042534 341446923 351508511 730849637 837221839 949983050
2 199758730 296525790 620719636 271569769 48989015 768611306 77253955
8
1 6208459 29989762 187741303 265062278 393002943 957915451 986759042
2 603327752 901822821 349826936 933716294 123962049 672761843 702453404
8...

output:

8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
1 0 0 0 0 0 0 0 1 
8
652846242 409604846 504991502 825789907 155114...

result:

ok OK (21 test cases)

Test #5:

score: 0
Accepted
time: 10ms
memory: 3980kb

input:

21
8
1000000008 82536156 95733833 173997609 176779824 454444312 524861364 586834996
4 841461190 384072747 954440743 152490383 894790857 441089967 851188211
8
1 62386922 117616238 344901582 692317472 798339321 934650757 967500526
4 923589217 91616771 328945919 250367604 465360899 562911768 673536418
...

output:

8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
2 0 0 0 0 0 0 0 2 
8
1 745551825 433482217 754346262 592338039 754346262 433482217 745551825 1 
8
2 0 0 0 0 0...

result:

ok OK (21 test cases)

Test #6:

score: 0
Accepted
time: 11ms
memory: 4208kb

input:

21
9
72520483 109296160 328830012 427629800 496439117 517407888 723526448 875376334 984205010
513501309 405430695 97038420 80044690 244607478 420952403 730491956 655670564 934113242
9
1000000008 1 196696216 367187687 520201124 575456207 634588206 768006032 938587173
0 2 305160038 629977990 316645777...

output:

9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
1 0 0 0 0 0 0 0 0 1 
9
694651336 138138597 62...

result:

ok OK (21 test cases)

Test #7:

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

input:

21
9
7776991 170135976 184357477 364912922 393159207 671848154 694727065 726096468 807558271
931408489 76229428 359286772 482810970 983371544 900415283 988630700 476855584 692102868
9
1000000008 1 254616697 350933937 613951686 792090796 806204674 896604470 996266271
0 4 296124300 133457045 889008814...

output:

9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
2 0 0 0 0 0 0 0 0 2 
9
1 704272955 206622628 292780706 947166666 947166666 292780706 206622...

result:

ok OK (21 test cases)

Test #8:

score: 0
Accepted
time: 9ms
memory: 4236kb

input:

21
8
1000000008 293188747 506560951 728885372 795956429 838708555 880755953 954756300
1 931650696 717763978 59630926 173745195 741697269 899703391 234180638
8
1 46322566 407158342 509723817 636040242 738500416 759476271 948754709
25 216101899 119160932 343194015 57776340 157262836 276807561 33982633...

output:

8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
1 2 3 4 5 4 3 2 1 
8
516624603 45597614 579384410 402240371 7036579...

result:

ok OK (21 test cases)

Test #9:

score: 0
Accepted
time: 11ms
memory: 4044kb

input:

21
9
75218911 90366076 119101189 194246800 350541227 377200962 818012261 895921660 966585262
732955481 335776396 765729084 902489414 875573484 526286992 675327718 219549932 52753284
9
1000000008 1 121073903 135154924 206002108 693217175 709348851 800428289 922910175
0 30 110846868 369125846 78199011...

output:

9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
1 2 3 4 5 5 4 3 2 1 
9
17709895 756176530 490...

result:

ok OK (21 test cases)

Test #10:

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

input:

21
10
1000000008 12260195 80754602 163716464 312829272 391611827 673741746 728563133 811628297 911803655
0 235646491 746092480 793242180 563675433 190413403 995430294 304276112 911389010 347436328
10
1 18892100 71240811 234644042 405445374 537145743 553798351 572060490 726412557 875107448
36 5419823...

output:

10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6 5 4 3 2 1 
10
1 2 3 4 5 6...

result:

ok OK (21 test cases)

Test #11:

score: 0
Accepted
time: 17ms
memory: 4084kb

input:

21
15
102902010 104440499 141407938 254801315 302108881 375503505 483498247 569424584 631076513 674425009 710414727 748037505 787597696 897754981 913961979
750445007 723764181 522261770 384970598 466582584 399445938 304490242 178761561 97731177 711994375 711199040 109300424 225657734 328363283 70380...

output:

15
33 16 52 95 8 73 90 18 18 90 73 8 95 52 16 33 
15
33 16 52 95 8 73 90 18 18 90 73 8 95 52 16 33 
15
33 16 52 95 8 73 90 18 18 90 73 8 95 52 16 33 
15
33 16 52 95 8 73 90 18 18 90 73 8 95 52 16 33 
15
33 16 52 95 8 73 90 18 18 90 73 8 95 52 16 33 
15
33 16 52 95 8 73 90 18 18 90 73 8 95 52 16 33 
...

result:

ok OK (21 test cases)

Test #12:

score: 0
Accepted
time: 20ms
memory: 4280kb

input:

21
15
190238676 408903599 473934421 488621309 500829135 684814169 779979654 813377310 866962260 874120900 882901969 929880722 939256395 956209677 995016475
508631129 882709950 185145270 713649239 983567479 998524204 67708788 859291 999492696 130232703 891966111 441494490 332533393 703135760 64268444...

output:

15
18 81 81 16 58 48 71 18 18 71 48 58 16 81 81 18 
15
18 81 81 16 58 48 71 18 18 71 48 58 16 81 81 18 
15
18 81 81 16 58 48 71 18 18 71 48 58 16 81 81 18 
15
18 81 81 16 58 48 71 18 18 71 48 58 16 81 81 18 
15
18 81 81 16 58 48 71 18 18 71 48 58 16 81 81 18 
15
18 81 81 16 58 48 71 18 18 71 48 58 1...

result:

ok OK (21 test cases)

Test #13:

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

input:

21
19
26294376 70967317 135772333 163164758 190196450 190331407 263742305 289352143 294421555 384429498 404563902 421898751 501143739 558923946 663294565 687319026 754424225 840450575 911028598
260487108 14726161 703228508 619949324 417344016 544228071 953555078 345998205 557232429 191999681 4600517...

output:

19
96 23 54 68 33 62 84 100 26 18 18 26 100 84 62 33 68 54 23 96 
19
96 23 54 68 33 62 84 100 26 18 18 26 100 84 62 33 68 54 23 96 
19
96 23 54 68 33 62 84 100 26 18 18 26 100 84 62 33 68 54 23 96 
19
96 23 54 68 33 62 84 100 26 18 18 26 100 84 62 33 68 54 23 96 
19
96 23 54 68 33 62 84 100 26 18 18...

result:

ok OK (21 test cases)

Test #14:

score: 0
Accepted
time: 26ms
memory: 4048kb

input:

21
19
65433256 203120539 230619032 242339653 306408928 319892667 358753761 406955804 456020246 568215116 658002035 667809083 713920687 758560518 792203516 826915826 868910207 947222195 979951831
710093141 609738169 294821300 319884586 559809243 118163813 202242806 53046643 383830818 669518255 473578...

output:

19
28 54 85 91 50 30 65 94 27 59 59 27 94 65 30 50 91 85 54 28 
19
28 54 85 91 50 30 65 94 27 59 59 27 94 65 30 50 91 85 54 28 
19
28 54 85 91 50 30 65 94 27 59 59 27 94 65 30 50 91 85 54 28 
19
28 54 85 91 50 30 65 94 27 59 59 27 94 65 30 50 91 85 54 28 
19
28 54 85 91 50 30 65 94 27 59 59 27 94 65...

result:

ok OK (21 test cases)

Test #15:

score: 0
Accepted
time: 26ms
memory: 3980kb

input:

21
19
94730190 98406141 117177150 151885244 178905728 222257031 349187661 384666078 386234223 455425437 470266682 722168666 809818898 835948150 860749403 917499921 934399177 956526573 989637011
303082625 162132429 408192664 585973108 271970371 500211566 129010096 685239539 653965708 393652022 994078...

output:

19
50 91 94 78 86 62 66 32 36 9 9 36 32 66 62 86 78 94 91 50 
19
50 91 94 78 86 62 66 32 36 9 9 36 32 66 62 86 78 94 91 50 
19
50 91 94 78 86 62 66 32 36 9 9 36 32 66 62 86 78 94 91 50 
19
50 91 94 78 86 62 66 32 36 9 9 36 32 66 62 86 78 94 91 50 
19
50 91 94 78 86 62 66 32 36 9 9 36 32 66 62 86 78 ...

result:

ok OK (21 test cases)

Test #16:

score: 0
Accepted
time: 22ms
memory: 4092kb

input:

1
1000
1000000008 1163314 1725881 1859188 1927255 4342530 4578730 4746103 5123392 5506632 6230591 7566874 8086831 8637758 8890521 9139570 9965029 10373127 11912148 12953170 13042845 14260540 14474386 14647027 16719219 17143558 17206396 17598422 18621675 19116034 20547451 20737458 20849209 21344486 2...

output:

1000
79575517 935081668 622423990 636314169 144962938 141608677 45549202 341682233 778977652 453994042 201348892 869626487 36301614 222442438 810013863 682259528 307591988 74561654 865182948 602546620 503622727 592141979 822723137 146617557 257332795 208689416 598623744 418635055 602842188 790204312...

result:

ok OK (1 test case)

Test #17:

score: 0
Accepted
time: 22ms
memory: 4256kb

input:

1
1000
1000000008 119871 1389570 2707693 3843539 4475280 5503109 5549495 6795010 6881337 7004323 7784996 8817035 10260341 11888079 13315748 13575297 15614332 16009588 16062325 18552071 21109298 22056617 22934163 23508035 26281837 26986091 28233931 30097845 30596645 31675568 31809106 33878728 3514484...

output:

1000
257920431 967312002 754148659 599813599 198657247 4255073 205357317 162913793 13556407 971226952 712695563 911842439 13175537 473968002 101763748 450088031 263579202 561428812 121431558 219709408 20961014 664435919 698890141 769188921 150065990 731810438 847809296 773977042 752404641 279478033 ...

result:

ok OK (1 test case)

Test #18:

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

input:

1
1000
1000000008 995271 1043526 1569741 1930761 2373180 2655267 2894638 2972099 3570020 3727464 5293902 5459186 5592012 7143746 8038917 8302839 8742904 9597001 10871411 12265577 13229016 13866685 14178506 15546918 15659624 16069122 16352870 18441557 18941292 20438984 20579817 21493813 21999600 2332...

output:

1000
501255971 151947671 15379387 40432587 410380585 932847170 103225974 997584739 699852020 81269848 791519323 291398574 853646708 115657125 950691825 189433956 345218295 288555342 72048515 285844713 681878453 294292577 8612288 639872842 31042508 295420878 917443062 364745349 285266528 384039334 77...

result:

ok OK (1 test case)

Test #19:

score: 0
Accepted
time: 22ms
memory: 4048kb

input:

1
1000
1000000008 1930327 3748583 4732516 5761677 6524408 6953970 7673074 10215389 11599237 12891198 13367997 13443691 13480811 13814537 14242925 15448701 16851660 17860191 18576284 20750503 21287239 21772850 21931267 24200127 25706412 26674484 27001628 29416809 29417481 29696933 31919132 32361009 3...

output:

1001
1 486572860 294479866 130023980 202947638 197815123 355158084 252065765 729051871 859325892 988802640 429927433 512426882 975236440 710089442 430240252 856663058 61882684 776771433 150421007 306874215 412648916 91317778 131866287 508211129 944477644 116678199 156036661 229874960 453031737 11655...

result:

ok OK (1 test case)

Test #20:

score: 0
Accepted
time: 22ms
memory: 4128kb

input:

1
1000
1000000008 19655 1057867 1964843 2826271 6349908 7186978 9276122 11144062 11910084 12130477 13712767 15211331 15439577 17431103 22303206 22618031 23229606 24087435 25793057 27118960 28967939 29863766 32133950 32224454 32229860 32973855 34256429 35288465 35428105 37461019 37639895 38513911 385...

output:

1001
1 759973984 498891287 473426386 176454837 966218053 356109743 886283851 372517913 704131304 101763227 290398885 564453524 701036684 935075147 374323901 787485312 28279382 598991748 691564480 645881832 772214536 94407034 491600342 304656404 559749300 102391892 973954148 977678466 296567378 91489...

result:

ok OK (1 test case)

Test #21:

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

input:

1
1000
1000000008 2123473 2337497 2647785 2714138 4307445 4578311 5599173 6100322 7262671 8156005 8717048 9035468 9622351 10544976 11210969 11400533 12274760 14890507 14904020 15890200 16450429 16952722 17869294 18432568 19673198 20047804 23509418 25269660 25383779 25455144 27481698 29629773 2975078...

output:

1001
1 292399259 59335213 332007268 865065777 801886116 83277824 213541879 742457275 950051591 389972758 490588170 500625980 372244906 675179679 647905891 763158337 543238509 840332696 466157702 995550004 97844310 860977499 271726749 722755128 539603994 582829150 978767602 776050455 58468574 2655172...

result:

ok OK (1 test case)

Test #22:

score: 0
Accepted
time: 22ms
memory: 4324kb

input:

1
1000
1000000008 1 979543 1099673 2311834 2392336 3331761 5232856 5668529 5853303 8253217 9412317 10576558 12212409 12972885 13090359 13401142 14359459 14936104 15009169 15325450 15889761 17492445 18234479 18367419 19877788 20196006 21459330 21965618 22568003 24705386 24908023 27175324 27645592 280...

output:

1000
875040106 280699124 387142789 156289401 113119764 231698527 568134600 201705284 342325462 637892505 284662306 112090695 881317853 253818873 428126974 64848144 666946232 16046000 956700128 133611760 712665170 169086466 738922597 123194460 643106545 225300668 53441513 682019016 230413433 44626739...

result:

ok OK (1 test case)

Test #23:

score: 0
Accepted
time: 21ms
memory: 4032kb

input:

1
1000
1000000008 1 4002897 4074300 7807719 9221820 10062677 10247707 11793051 12076502 12383773 12850315 12909440 13699665 14669717 17364634 18334687 18488120 19251198 19327484 19351685 21227522 21473157 22536795 23445221 24786248 25276279 25516212 28760808 28997973 30065464 30458276 30865599 31228...

output:

1000
677490484 34172339 425915220 133272717 525533229 497270494 69060070 728759223 494156373 365238799 88340994 210682693 798755901 542372007 639584015 837271699 331303174 949443697 33441551 974757662 957173392 470387 508380030 823350231 934835917 767377046 942616254 653535532 114963770 69252437 578...

result:

ok OK (1 test case)

Test #24:

score: 0
Accepted
time: 22ms
memory: 4088kb

input:

1
1000
1000000008 1 1020644 5382771 5719073 6493197 7113938 7716494 9076935 9900713 12520522 13643863 14906033 15306765 15520944 16541433 17389045 18586011 19460259 20441544 21264034 21593776 23108118 25344994 26032018 29105874 29507267 31940778 32334657 32350077 32372905 33037067 33369145 34839406 ...

output:

1000
324400949 138285803 462932276 949332334 799317485 110578698 32991752 988658071 114579580 156197354 845254329 122647862 127745259 196929514 618844963 457937567 610323286 94294405 999013365 98901407 38224877 901618608 568697948 449088553 151609376 6909982 890319078 117709970 123579938 19357588 27...

result:

ok OK (1 test case)

Test #25:

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

input:

1
1000
459429 699878 1274783 1464867 2263572 2791534 3527960 4706024 6945270 7888629 8613660 8722107 8742188 9003703 10916249 11336542 12438667 12708870 14332440 16686112 16896938 17257014 19457577 20651141 22022600 23446548 24162091 25735242 27706189 28900858 29566281 31433967 32485062 32890720 330...

output:

1263
821889274 819514043 760624560 982751614 121795344 793606872 519539874 174901527 92542976 928994554 332834262 924858696 111636111 114966801 248619415 381002393 869485263 843074837 40980862 143965708 338617575 951157039 519714545 907458683 440376868 329507719 890437486 510715144 225464351 4096855...

result:

ok OK (1 test case)

Test #26:

score: 0
Accepted
time: 21ms
memory: 4084kb

input:

1
1000
539582 587787 823210 1838290 2968320 4763018 5452385 5759375 7499639 9268735 10059629 10426675 11252932 12083704 12772856 13255096 15256882 15398881 16556597 17094215 17824573 18058249 19298525 26461962 26540463 27208624 28878283 29337698 29508878 29750225 29816065 30030072 30700382 32937761 ...

output:

1107
323750516 192582328 916443943 153418384 504980786 282329497 871120254 757505703 703248936 282406312 292842202 114296812 607524153 812088215 693634571 668584555 486694258 183271514 170366252 167105304 969352772 979642079 28793424 818053293 58428847 296595261 964493051 141550825 387439099 1530187...

result:

ok OK (1 test case)

Test #27:

score: 0
Accepted
time: 18ms
memory: 4088kb

input:

1
1000
1400971 1525412 1895243 2886037 2935228 2953133 3648417 3848336 5149240 5665376 5805252 7627425 8262327 10896987 12584489 12609031 12775145 14176272 14403849 15101570 16731600 17493993 21095811 21269540 21865611 21996684 24659823 25151457 25644882 25843765 26226417 26507726 27698139 28396383 ...

output:

1461
472602966 403248346 879205055 355815189 265989559 466376728 897908522 459631554 587085902 219461940 279734770 88144595 447965662 810494031 490085103 452970422 600515518 234924502 224943088 908454061 78843568 384455642 2056642 246946347 698627000 732396265 490188733 814656268 507716127 877060288...

result:

ok OK (1 test case)

Test #28:

score: 0
Accepted
time: 18ms
memory: 4096kb

input:

1
1000
18257 2517136 2754522 3446997 3572234 3605609 4467547 4867328 5022683 6204397 7174270 8070365 8480158 9091902 10467727 11532430 11927584 13251677 13286612 13960248 14528228 14753170 15245960 16201420 17810446 17901664 19852933 19925622 20407743 20582958 20617713 21204188 21668313 22997268 234...

output:

1286
970945761 778369866 503500246 305324978 846848529 583259300 962299483 288667649 152311616 326450838 60099825 282682730 399985130 521053415 488917093 72742154 3268491 181730711 287991782 542430502 477046742 257448733 943982222 959295353 160852489 869795073 22804030 264345224 130562795 760940133 ...

result:

ok OK (1 test case)

Test #29:

score: 0
Accepted
time: 21ms
memory: 4092kb

input:

1
1000
996737 1536175 3101070 3644382 5170720 5787576 6266386 9714384 9834864 10495517 14090608 14642514 15311125 15793968 16310838 17244201 17316962 17585111 18479026 19707052 19839248 20025852 21127374 21714531 22326012 22524961 22528119 23538749 24774379 33421876 34041195 34456463 34531389 369802...

output:

1998
452839040 460175872 194564680 648235170 142247758 868958621 558303567 875052273 495697070 855526913 230749608 980486207 295951048 575356763 247477750 256035508 615355823 635744064 13428949 903215371 758559730 394000157 230065014 70081861 426623249 559351969 12941599 359386161 963822406 24369825...

result:

ok OK (1 test case)

Test #30:

score: 0
Accepted
time: 18ms
memory: 4092kb

input:

1
1000
782165 818688 2385162 2504686 3746632 3810165 4398857 4905098 6244695 6489354 7213334 7653067 8091494 8142002 9238224 9638275 10692110 11290778 12619875 12886372 13068826 13740051 14689310 15762919 16498511 18469126 19480024 20070327 20364643 20406003 21855872 22034565 22721542 24506788 25382...

output:

5068
91126876 349444604 577660465 3863828 563642401 650007615 330365152 610119674 637996561 707383150 779339111 82487268 768104279 286946053 862481913 137716272 168720467 593674291 814091281 247566034 787787263 683366062 228004870 740401710 896171820 558933864 390707938 9765424 293491613 942854603 4...

result:

ok OK (1 test case)

Test #31:

score: 0
Accepted
time: 22ms
memory: 4088kb

input:

1
1000
1000000008 1 65747 867548 2909364 3566380 4307576 6281702 6849581 9004452 9421540 9652914 10782791 10827322 12408129 13657581 14320403 14966315 15286154 16077116 16306015 17456970 18103823 18576529 19640517 20120108 20974376 21146685 21691051 23155596 23483018 23795267 24773978 25191064 25465...

output:

3818
49815438 162196579 831903019 918944872 920263786 995693950 116280852 204305258 107485393 286299912 438481843 500675871 439840254 9583264 853709388 369726706 728993603 62754001 934468751 624179516 274377604 734423368 429898712 683179630 892555514 687426807 914154391 613936812 226799972 101364601...

result:

ok OK (1 test case)

Test #32:

score: 0
Accepted
time: 21ms
memory: 3968kb

input:

1
1000
1000000008 1 155415 1120795 5075090 5177841 5400240 5939545 6126832 6686481 6742156 7555095 8548302 8719620 8760748 9630584 10548298 11929056 11963247 13342890 13462765 14568520 14853846 15509357 15642103 19105061 19119816 22065447 23896409 25071710 25850281 26198108 27466856 29576775 2973926...

output:

1950
155559720 313373209 663734265 999814360 993734289 901926370 489457848 254083690 246092996 312836180 658022775 20404681 543185607 604842380 740491935 176337769 349905906 72376734 529956779 752921336 767675359 921709328 23016053 752648937 854845211 270111786 614350465 780973037 127412826 52464171...

result:

ok OK (1 test case)

Test #33:

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

input:

1
1000
1000000008 1 3794823 3990160 4069010 7200609 7545237 7625903 7650923 7733012 8150039 10453187 11194942 11992704 12565148 12672036 14197425 14297429 14923010 15319779 15437211 16212886 17214909 19584436 19709541 19803867 20615123 20736540 21014631 22135416 22185505 22580462 22672626 23621938 2...

output:

5832
450009795 978318951 365855409 312109161 986020888 350319699 386091388 953868842 81537912 871653210 437205162 389907267 357751580 924965790 354377953 835043710 688343093 205515942 514275271 184466321 827333987 664428013 240262041 314852028 664363167 606055322 301692207 473017828 226650713 446563...

result:

ok OK (1 test case)

Test #34:

score: -100
Wrong Answer
time: 16ms
memory: 4008kb

input:

10
100
2293126 5942420 6337941 13099309 15116089 17067398 29529174 33256334 41013027 44923450 45673733 49287672 55640824 74354927 89743825 113199983 113795966 115263356 115429622 123843442 124728214 143038491 148791867 150711496 154560895 182479530 183537789 186924669 211790168 215889394 219573024 2...

output:

9997
226236616 490329761 632862686 544447755 94828130 489397658 667756524 294192922 731401772 245300202 599445394 674791687 274928939 771839869 421155935 103591398 332001788 407146533 304902104 395955727 994027798 807395665 677296812 465462454 779044172 81962918 543704012 101271266 679621028 4702669...

result:

wrong answer Test case 2: there is a solution, but printed -1. (test case 2)