QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#322588#5743. Palindromic PolynomialDaiRuiChen007AC ✓147ms4680kbC++172.3kb2024-02-07 11:47:372024-02-07 11:47:38

Judging History

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

  • [2024-02-07 11:47:38]
  • 评测
  • 测评结果:AC
  • 用时:147ms
  • 内存:4680kb
  • [2024-02-07 11:47:37]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=1e4+5,MOD=1e9+9,i2=(MOD+1)/2;
ll ksm(ll a,ll b=MOD-2,ll p=MOD) {
	ll ret=1;
	for(;b;a=a*a%p,b=b>>1) if(b&1) ret=ret*a%p;
	return ret;
}
ll x[MAXN],y[MAXN],f[MAXN],g[MAXN],t[MAXN];
void solve() {
	memset(x,0,sizeof(x));
	memset(y,0,sizeof(y));
	memset(f,0,sizeof(f));
	memset(g,0,sizeof(g));
	memset(t,0,sizeof(t));
	int n,d=-1;
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%lld",&x[i]);
	for(int i=1;i<=n;++i) scanf("%lld",&y[i]);
	vector <array<ll,2>> pw_lims;
	for(int i=1;i<=n;++i) for(int j=i+1;j<=n;++j) {
		if(x[i]*x[j]%MOD==1&&(y[i]||y[j])) {
			pw_lims.push_back({x[i],y[i]*ksm(y[j])%MOD});
		}
	}
	if(pw_lims.empty()) d=2*n;
	else {
		for(int i=10000;~i;--i) {
			bool ok=1;
			for(auto&p:pw_lims) if(ksm(p[0],i)!=p[1]) ok=0;
			if(ok) { d=i; break; }
		}
		if(d==-1) return puts("-1"),void();
	}
	map <ll,ll> f_val;
	ll v0=-1;
	for(int i=1;i<=n;++i) {
		if(!x[i]) v0=y[i];
		else {
			f_val[x[i]]=y[i];
			f_val[ksm(x[i])]=y[i]*ksm(x[i],MOD-1-d)%MOD;
		}
	}
	if(!v0) return puts("-1"),void();
	int len=0; f[0]=1;
	auto mul_poly=[&](ll k) {
		++len;
		for(int i=len;i>=1;--i) f[i]=(f[i]*k+f[i-1])%MOD;
		f[0]=f[0]*k%MOD;
	};
	auto div_poly=[&](ll k) {
		ll inv=ksm(k); f[0]=f[0]*inv%MOD;
		for(int i=1;i<=len;++i) f[i]=(f[i]+MOD-f[i-1])*inv%MOD;
		--len;
	};
	vector <ll> fx,fy;
	int m=f_val.size();
	for(auto&p:f_val) fx.push_back(p.first),fy.push_back(p.second);
	for(int i=0;i<m;++i) mul_poly(MOD-fx[i]);
	for(int i=0;i<m;++i) {
		ll co=1;
		for(int j=0;j<m;++j) if(i!=j) {
			co=co*(fx[i]+MOD-fx[j])%MOD;
		}
		co=ksm(co)*fy[i]%MOD;
		div_poly(MOD-fx[i]);
		for(int j=0;j<=len;++j) g[j]=(g[j]+f[j]*co)%MOD;
		mul_poly(MOD-fx[i]);
	}
	for(int i=d+1;i<=len;++i) if(g[i]) return puts("-1"),void();
	for(int j=0;j<=d;++j) t[j]=g[j];
	for(int j=0;j<=d;++j) g[j]=(t[j]+t[d-j])*i2%MOD;
	if(!g[0]||(~v0&&g[0]!=v0)) {
		for(int i=d+1;i<=len;++i) if(f[i]) return puts("-1"),void();
		ll di=~v0?(v0+MOD-g[0])%MOD:1;
		for(int j=0;j<=d;++j) t[j]=(f[j]+f[d-j])*i2%MOD;
		ll co=di*ksm(t[0])%MOD;
		for(int j=0;j<=d;++j) g[j]=(g[j]+co*t[j])%MOD;
	}
	printf("%d\n",d);
	for(int i=0;i<=d;++i) printf("%lld ",g[i]);
	puts("");
}
signed main() {
	int T; scanf("%d",&T);
	while(T--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 4208kb

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: 6ms
memory: 4216kb

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: 47ms
memory: 4420kb

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: 23ms
memory: 4164kb

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: 27ms
memory: 4496kb

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: 29ms
memory: 4200kb

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: 30ms
memory: 4476kb

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: 27ms
memory: 4508kb

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: 30ms
memory: 4208kb

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: 34ms
memory: 4500kb

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: 52ms
memory: 4508kb

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: 52ms
memory: 4240kb

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: 65ms
memory: 4288kb

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: 65ms
memory: 4216kb

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: 61ms
memory: 4220kb

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: 147ms
memory: 4312kb

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: 147ms
memory: 4588kb

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: 147ms
memory: 4312kb

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: 143ms
memory: 4296kb

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: 147ms
memory: 4352kb

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: 147ms
memory: 4372kb

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: 147ms
memory: 4356kb

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: 147ms
memory: 4600kb

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: 147ms
memory: 4584kb

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: 144ms
memory: 4268kb

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: 146ms
memory: 4296kb

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: 138ms
memory: 4312kb

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: 140ms
memory: 4300kb

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: 135ms
memory: 4336kb

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: 92ms
memory: 4308kb

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: 110ms
memory: 4308kb

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: 136ms
memory: 4588kb

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: 80ms
memory: 4236kb

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: 0
Accepted
time: 6ms
memory: 4240kb

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:

ok OK (10 test cases)

Test #35:

score: 0
Accepted
time: 39ms
memory: 4388kb

input:

1
1000
1000000008 1 608809 2224418 2326580 2581597 2695175 4257301 4479801 4799707 5130361 5204849 6780675 6896748 7061506 7644954 7961444 8003206 8027106 9508105 9821035 10575547 10789292 10912576 12658630 14498860 15393382 15512131 15681489 16648049 16784819 17598541 18724939 19801366 20241696 204...

output:

10000
736256376 640308611 103355445 269096702 546488132 982145922 260783839 159569523 2303445 235828721 617638137 66471280 964796356 681582116 211543734 815045029 639029391 561694750 984658760 715037739 398791669 466441442 704624296 978408707 156438374 788689630 690171389 275186413 397334075 9339604...

result:

ok OK (1 test case)

Test #36:

score: 0
Accepted
time: 84ms
memory: 4224kb

input:

42
1
0
0
5
0 1 2 3 4
0 1 2 3 4
17
1000000008 89972839 143164456 150216222 375988435 396176433 406913122 480521943 498414429 524078486 542182493 594307752 654089635 712922007 721980374 778983440 846984859
357907157 200159115 60068034 155124844 775922328 419112157 111254958 90487512 492415083 43233847...

output:

-1
-1
3584
67601906 165724707 100776992 380160989 222274983 367918513 173366846 355523876 227690308 637439625 464155726 649450238 504508255 683868785 228159613 279854333 210360002 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok OK (42 test cases)

Test #37:

score: 0
Accepted
time: 47ms
memory: 4524kb

input:

1
1000
1000000008 315952 463447 2030731 2235229 2753764 3129061 3763222 3925015 4922414 7349688 7504468 8267482 8342770 9522784 10292190 11241711 12053758 12295998 13049516 13248404 13421074 14366482 14831105 14950327 16223781 17603183 18455523 18929019 19499405 21298766 21608709 21877637 22134500 2...

output:

-1

result:

ok OK (1 test case)

Test #38:

score: 0
Accepted
time: 114ms
memory: 4104kb

input:

1
1000
0 1 64138 327873 516439 1707007 1945928 2469231 3176639 4190304 5097280 5425765 6419611 6730124 6813712 7602054 8033670 8520720 8567066 9599309 10336833 11624583 11913593 12049732 13811566 15781789 16151933 17586478 17682766 19333296 19400349 19450249 19510196 20377666 20933571 21235664 21882...

output:

-1

result:

ok OK (1 test case)

Test #39:

score: 0
Accepted
time: 84ms
memory: 4396kb

input:

1
1000
464961 749361 1468292 1672179 1968878 2843988 3670283 6114180 6187520 6324060 7206578 7916729 8927862 9080856 9593491 10586704 10720120 11102204 11498377 11567165 13225984 14596828 14628491 15662570 15869464 16105087 16563159 17177119 17905392 18353534 19022467 19265140 22843311 23680419 2513...

output:

-1

result:

ok OK (1 test case)

Test #40:

score: 0
Accepted
time: 142ms
memory: 4360kb

input:

1
1000
2 500000005 3 666666673 4 750000007 5 200000002 6 833333341 7 857142865 8 875000008 9 888888897 10 100000001 11 363636367 12 916666675 13 615384621 14 928571437 15 733333340 16 437500004 17 58823530 18 944444453 19 368421056 20 550000005 21 952380961 22 681818188 23 826086964 24 958333342 25 ...

output:

-1

result:

ok OK (1 test case)

Test #41:

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

input:

1
1000
2 500000005 3 666666673 4 750000007 5 200000002 6 833333341 7 857142865 8 875000008 9 888888897 10 100000001 11 363636367 12 916666675 13 615384621 14 928571437 15 733333340 16 437500004 17 58823530 18 944444453 19 368421056 20 550000005 21 952380961 22 681818188 23 826086964 24 958333342 25 ...

output:

-1

result:

ok OK (1 test case)

Test #42:

score: 0
Accepted
time: 145ms
memory: 4396kb

input:

1
1000
2 500000005 3 666666673 4 750000007 5 200000002 6 833333341 7 857142865 8 875000008 9 888888897 10 100000001 11 363636367 12 916666675 13 615384621 14 928571437 15 733333340 16 437500004 17 58823530 18 944444453 19 368421056 20 550000005 21 952380961 22 681818188 23 826086964 24 958333342 25 ...

output:

-1

result:

ok OK (1 test case)

Test #43:

score: 0
Accepted
time: 145ms
memory: 4104kb

input:

1
1000
2 500000005 3 666666673 4 750000007 5 200000002 6 833333341 7 857142865 8 875000008 9 888888897 10 100000001 11 363636367 12 916666675 13 615384621 14 928571437 15 733333340 16 437500004 17 58823530 18 944444453 19 368421056 20 550000005 21 952380961 22 681818188 23 826086964 24 958333342 25 ...

output:

-1

result:

ok OK (1 test case)

Test #44:

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

input:

25
35
15005825 35302900 79331670 96289428 115381398 136247216 185087831 192250338 229084603 237034597 312599432 431551491 463330573 469754533 500992688 529481034 535673813 540179374 544174469 561216551 616249357 681777421 703827282 723637712 744737153 774301659 780468679 784852730 817657942 84846648...

output:

9998
26512321 228123642 430131213 33769107 700713436 438840160 346893398 645010256 296646467 645583506 226784668 977565097 584703622 87661460 860457344 391026555 448666943 423930129 131210321 783928174 332146926 610357760 288026094 54982223 622996304 534057744 797950711 87967421 796111699 193207750 ...

result:

ok OK (25 test cases)

Test #45:

score: 0
Accepted
time: 43ms
memory: 4356kb

input:

1
1000
512995 673429 2517134 3126968 3975094 4035899 4707612 6633424 8319164 9306333 9842431 10955294 11540175 12018118 15445423 15941025 16204954 16297641 17861655 21184588 21465421 23173707 25825040 26058606 27892502 29153788 30028535 30473453 31277472 31606620 31844694 33708849 34006101 35014115 ...

output:

9999
560353761 443109093 597003075 858622169 477315952 894860242 60120937 12388957 542689912 313695162 920760116 577803757 393841286 51960329 159330802 960746387 43489096 495437372 788706788 888221083 415354943 445378133 654233717 997392186 663270184 457631179 781000731 357333104 196302085 49734631 ...

result:

ok OK (1 test case)

Test #46:

score: 0
Accepted
time: 47ms
memory: 4392kb

input:

1
1000
351793 859041 1395307 2480430 2899199 2937592 4448687 4953957 5880016 6562890 9150507 9406949 9528307 9593976 10169417 10716000 11088660 12645474 14983122 16417899 17422872 17892227 18437295 18801714 18873667 19572980 20539615 22310670 23396125 23759313 23789911 23843637 24091595 25321776 261...

output:

9999
192297933 305844985 915073541 424847452 702474857 829099227 807489940 486444909 277251848 386470628 310621871 653229558 214502957 563184353 862070861 264570076 981848306 145680602 842554553 738683770 61846598 286013853 276737784 176235415 529560552 736092990 824961244 846677352 373210768 851889...

result:

ok OK (1 test case)

Test #47:

score: 0
Accepted
time: 47ms
memory: 4400kb

input:

1
1000
491244 652071 1666725 2245508 2309623 3674278 3815190 3895176 4956515 5522405 7537365 8362107 8444302 8616346 8968438 10327819 10419925 10555358 10989561 11259157 12406771 15114514 15583101 15748986 16089431 16314547 16740769 18612633 19772171 22601657 23180475 24414392 24740704 24768505 2553...

output:

10000
292448924 663080611 10220282 957307449 735425776 283457790 84899304 746822785 781570370 601348025 362161868 98982724 846139324 230224477 703186374 919997143 458178760 401457707 763612684 398982751 24438747 284927473 702676533 568411126 134924096 179971270 666408756 605999377 244079982 75577190...

result:

ok OK (1 test case)

Test #48:

score: 0
Accepted
time: 47ms
memory: 4448kb

input:

1
1000
410716 1339786 2155946 2774561 3624086 3972426 4119112 4679152 4944340 6889207 7070836 7355624 7656760 8593994 9739580 11432916 11607158 12460737 12832336 13038918 14177276 14522871 15419287 15464353 17027524 17957534 18709000 19743076 20812754 23499539 23759623 26131682 26765427 26830903 281...

output:

9999
675708468 272768868 522937472 347497411 131226506 690219476 908525286 631819418 139538805 582619617 224295039 665870826 711588450 500781690 680625821 405230362 804367093 395305468 591976551 732507562 552955040 290916133 832380585 298269507 254339611 210051158 10503304 827638319 543864429 154889...

result:

ok OK (1 test case)

Test #49:

score: 0
Accepted
time: 47ms
memory: 4672kb

input:

1
1000
237762 543844 2089941 2319338 4967911 5029817 6412997 7871781 8013512 8127029 8183272 8722653 8782294 9493111 11153463 13078177 13578078 13719354 13768511 15101991 15129690 15543372 17808784 18377048 19595196 19708014 20358715 22006340 22914605 24553195 25489801 25586431 25874483 26111708 278...

output:

9998
578235619 106635555 114033646 735342472 796995207 732269400 395922874 454795234 657813614 204016645 271950231 39728183 841901890 1538688 118938791 73136266 837571192 246038091 659928447 277699857 489266139 496819415 777074561 714113515 422487137 286346541 725013652 493507816 871091947 378303427...

result:

ok OK (1 test case)

Test #50:

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

input:

100
8
2159 1987 7869 634 1171 2406 9110 2501
0 2 1 2 1 3 1 1
6
7831 2289 8471 9887 1635 873
1 2 1 2 1 1
10
5667 9085 4539 122 708 4743 6535 7751 3975 2680
5 5 3 7 3 2 7 4 3 4
2
477 6541
0 0
6
9798 8860 5213 2193 1883 71
1 0 1 0 2 0
5
2432 4723 4433 8896 1811
3 9 3 5 3
9
4698 7750 6545 2727 5942 6454...

output:

16
1 275885104 683337403 917311902 775702649 597184898 127761020 278245649 193857489 278245649 127761020 597184898 775702649 917311902 683337403 275885104 1 
12
1 866657691 33125603 555932241 538099409 723751966 776361135 723751966 538099409 555932241 33125603 866657691 1 
20
1 990645224 878454067 3...

result:

ok OK (100 test cases)

Test #51:

score: 0
Accepted
time: 47ms
memory: 4360kb

input:

1
1000
298699983 71839533 272804887 609675203 473225026 749854536 973389054 141662192 807676138 454286073 484030182 690348440 914886325 436720094 202418140 6269318 634190505 4061686 661049839 773575720 944825500 196653484 693782879 370586846 912838735 39236005 986787256 373349111 926867298 647215880...

output:

2000
1 323520901 677660008 509149473 756844506 853579833 139869318 90069313 441449150 230230765 768420637 150697109 500382350 907661271 345132814 243483200 17241993 94025903 273686314 796093630 900749225 705320646 126608131 13294643 913320980 698418341 574032566 917115995 320974372 868932095 5165430...

result:

ok OK (1 test case)

Test #52:

score: 0
Accepted
time: 47ms
memory: 4460kb

input:

1
1000
471582494 608857167 198701022 543329239 977654864 393785803 278900201 341127137 422575329 441762188 385105059 609122432 392085879 717280955 312664738 125258226 693308945 590269418 92253512 257959157 44593184 74407678 614403829 80623331 270127146 134400606 70652869 846819456 465530618 52816771...

output:

2000
1 47576671 940054664 775262623 651897141 305243580 153201076 7381832 848414891 675150252 706929252 476510816 139305284 400206037 559118565 337103376 549901300 322124255 51133308 761548548 614166178 474602362 912028113 549410325 649722396 816824834 986557597 758962205 343764317 523580045 2308058...

result:

ok OK (1 test case)

Test #53:

score: 0
Accepted
time: 47ms
memory: 4648kb

input:

1
1000
837868675 78241049 139392295 101199738 484122022 129266839 458044226 333546872 341663438 630305353 514582877 153995378 256844528 788797657 365610842 278513693 338523391 500189646 864380373 966447995 810322030 101022521 306599757 97084284 128433746 578003432 336198001 347205697 99861046 337950...

output:

2000
1 847527773 978638317 55262276 350244465 288692435 788711366 616093280 93872803 648869796 503878568 185617319 883082447 47650408 285950398 575174919 995135548 795238717 843596994 447695069 687245114 749227875 662468864 710876239 732336551 332963174 239797209 640889856 623171965 469369078 998214...

result:

ok OK (1 test case)

Test #54:

score: 0
Accepted
time: 47ms
memory: 4400kb

input:

1
1000
258876415 869270173 704514530 8747694 71789902 150046010 667635493 186612422 165416523 538762027 6104816 390661337 144291364 82224124 126462569 942231732 610948328 230733219 952933692 915903969 142523897 33429350 120081344 340060422 188581599 56783030 935131862 78651223 505110530 61854634 969...

output:

2000
1 155520918 325877659 428879986 383467500 534259128 640208696 747839171 712844152 123492622 159829532 203293024 483032848 836206736 290705019 784405072 952391238 684163277 932776596 14425835 332981272 179295088 675275272 985232201 198612547 355275777 104782278 757818071 927931200 98976285 25480...

result:

ok OK (1 test case)

Test #55:

score: 0
Accepted
time: 47ms
memory: 4384kb

input:

1
1000
200100918 795800066 353940697 802483543 365760200 601504710 745757341 165461366 185934494 498277721 758067937 687237671 120948764 828476815 242727693 286582656 970297115 385573524 590439674 975651371 699804778 203029159 495370921 465573432 848130772 53284517 525405023 78262123 616067810 69418...

output:

2000
1 141716986 163867841 197183042 274891350 872323962 118208563 370784817 122729544 174262874 524668067 802830030 527591939 484317131 432550829 829853614 60283952 968257058 158108284 820950940 173946452 403736266 799156443 389788439 138454058 660622103 984257732 9871597 714710751 629593437 165518...

result:

ok OK (1 test case)

Test #56:

score: 0
Accepted
time: 47ms
memory: 4464kb

input:

1
1000
568882453 866921441 622062491 873863856 381158118 445346461 65029708 32273878 395642401 107646808 268435820 396957121 974255329 567249996 952164285 4581868 76247712 184186362 227058746 399439886 939971238 661362236 903057557 347419054 18700390 110973279 258229733 292862024 121080912 442166864...

output:

2000
1 259212087 100713781 407729605 532170064 638230754 946495020 506946621 241524053 855402954 521206521 576584372 955929487 636272021 512557189 909185253 39953908 789685482 573858421 976910086 500756339 713938726 805988640 405639143 975030160 876899469 241698734 489663311 430084639 832791119 8318...

result:

ok OK (1 test case)

Test #57:

score: 0
Accepted
time: 47ms
memory: 4668kb

input:

1
1000
709630619 233392114 233490524 328355525 231770597 121661469 406859230 519226153 125838969 802644071 646478508 312625167 611950221 367383798 634594937 872919035 99866512 266454799 203237109 125768812 792994899 27374851 621484344 713673656 619086073 256614361 885654145 791634297 278801461 12529...

output:

2000
1 765970110 446716517 761328377 315050088 799340310 106231833 651880223 762425085 575873401 539007972 943349495 84681427 897152428 282500969 217746175 437700395 50194834 453528553 478158329 480838635 75136902 116232223 505512585 217376609 851831512 297170371 198259869 395568886 272796269 293697...

result:

ok OK (1 test case)

Test #58:

score: 0
Accepted
time: 47ms
memory: 4376kb

input:

1
1000
13430074 68053963 142536141 823993368 307651118 750974308 122721917 27803195 212575401 998142291 362131204 276319375 555378218 850811309 643615222 591960993 607055329 843399650 196352391 745573336 815096089 495565101 2055273 515976415 657288143 758957759 631333443 534349985 582662343 12953621...

output:

2000
1 698714580 673259626 596787198 74684670 614989339 890488401 55770963 461805029 995899300 132348261 866661252 894463985 100241670 151449476 437796008 81614363 218929520 497695990 374244002 145664895 789000414 622165337 513920897 597147722 796302774 102630737 490374927 952414978 349011781 801652...

result:

ok OK (1 test case)

Test #59:

score: 0
Accepted
time: 47ms
memory: 4356kb

input:

1
1000
996315489 864408851 706867143 432147930 90577965 105142532 533411388 431240855 2587857 56100149 426658172 534467444 698501065 556317636 866705052 825625003 297678838 778146756 990328307 264573814 77868086 614255629 954719100 720205711 246039604 779345383 736534257 28739737 79905513 11381269 1...

output:

2000
1 973202788 389615351 623248737 883540726 876299112 676986545 46784061 315444585 364273026 907106910 839726048 781797382 48430316 755685476 108942817 840436952 580492541 596306992 907849929 632187096 801883919 118541349 741497849 142057865 26157200 18498883 62326804 717107805 64764354 983013914...

result:

ok OK (1 test case)

Test #60:

score: 0
Accepted
time: 47ms
memory: 4340kb

input:

1
1000
457751014 213289071 251503444 536030823 791915559 763521736 293725605 643680040 697607289 99992512 812614859 131224112 296412824 677658837 970714147 902738262 86168872 505696725 228995700 6507825 336298379 58994046 225628057 826539394 117993455 202124485 674587943 963946152 605838714 1500169 ...

output:

2000
1 539706737 935422114 882357730 907607609 725029176 495209342 604462726 526048570 24488643 295909091 411392447 317594018 921824397 237990383 864497037 662759242 406000858 547398800 147674671 895839411 468887915 501130316 690434022 614445589 634435661 83145396 433130616 660080927 759505873 96922...

result:

ok OK (1 test case)

Test #61:

score: 0
Accepted
time: 99ms
memory: 4264kb

input:

10
100
3934643 4798522 7605978 11923203 14307332 15580656 32012253 38191910 43993984 45364716 78838742 83087817 90772142 91190649 99533851 99824878 103401232 112419020 113115656 113164985 115324483 137547613 138956855 145884258 168772739 189311060 191290717 195643045 225336739 226606897 273129924 27...

output:

0
1000000008 
0
733864939 
0
544334186 
0
933844347 
0
443664609 
0
301874929 
0
936255122 
0
135899304 
0
441196626 
0
328295955 

result:

ok OK (10 test cases)

Test #62:

score: 0
Accepted
time: 3ms
memory: 4240kb

input:

16
3
498228753 578689441 730510790
0 0 0
4
58521981 112072242 124592199 453635303
0 0 0 0
5
565603334 679983788 800479439 980949712 1000000008
0 0 0 0 0
6
6113693 302215705 365378713 391403530 746823222 909662466
0 0 0 0 0 0
7
256511619 280347562 282864204 728761951 873718619 938853095 1000000008
0 ...

output:

6
1 921448517 833665721 42546055 833665721 921448517 1 
8
1 900819541 983859257 94364874 967718503 94364874 983859257 900819541 1 
10
1 500149770 870792374 335568310 835718079 741584739 835718079 335568310 870792374 500149770 1 
12
1 133257006 506390264 291750716 857605131 425007722 12780519 4250077...

result:

ok OK (16 test cases)

Test #63:

score: 0
Accepted
time: 23ms
memory: 4344kb

input:

1
1000
699372 1534202 3033857 3745540 7731895 8938225 10276776 12148555 12350970 16460229 16550984 16990743 17051566 18019424 18816669 19091679 21245438 21267586 22236212 23856554 24004664 25554538 25615989 25900024 26669622 26781777 28005497 29811563 29909664 30296728 30379425 30677835 30699321 315...

output:

2000
1 151186487 849730112 313102466 724990629 455571972 439219694 797064453 919478612 643105992 350096820 990442528 614036768 19560541 684078436 167909295 567932478 114093462 968746925 695370976 416248182 127745551 310731959 189449405 669639205 111932106 539838845 310670241 420000784 458148775 9298...

result:

ok OK (1 test case)

Test #64:

score: 0
Accepted
time: 47ms
memory: 4464kb

input:

1
1000
333549936 428635227 921132541 558546162 227657291 459822517 173228834 971077420 34902350 641109994 352983378 655874888 895383433 971558780 548743161 26948189 964476685 394961115 776338457 150430831 359410359 841975403 971885844 587609505 290913367 843469988 42629684 81605355 52191087 30027368...

output:

2000
1 681504687 420724640 53190909 27739996 302579341 811659704 830633759 203843927 831014748 445563654 342108437 25378714 75612937 805840791 923259727 863873606 192135120 662255667 337352145 964402199 485112058 996848465 241396909 483817538 244548906 555272282 925115708 31594534 938960528 98886216...

result:

ok OK (1 test case)

Test #65:

score: 0
Accepted
time: 47ms
memory: 4680kb

input:

1
1000
9691221 901694893 473398619 513101530 834260797 645135866 332294947 978473773 235778169 171178606 616758410 551338914 103813253 225455105 590513663 59848047 399015446 549502010 75192658 669056509 667060791 419011967 6465135 537706406 269732418 225819561 759226420 754828933 315214073 805779150...

output:

2000
1 231732602 160786145 552423241 301725810 315213606 495249074 723870934 168645438 487699633 278920665 275117347 418194501 388689269 315950128 156970952 851553940 778455811 505019729 65438331 523523943 249619219 810295573 225039135 40799282 65682197 735993185 225319772 593476231 509253978 867895...

result:

ok OK (1 test case)

Test #66:

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

input:

100
1
667927693
41124999
1
273769948
98729565
1
971429091
184257600
1
464910956
969056952
1
602415638
98111160
1
809713190
134839965
1
735141938
107115898
1
981522522
867849790
1
742145657
666795904
1
953689328
528325527
1
532129123
898827204
1
971100694
832763455
1
846142997
290376070
1
434247209
7...

output:

2
1 967895303 1 
2
1 367907778 1 
2
1 344832961 1 
2
1 486846081 1 
2
1 766970637 1 
2
1 98529432 1 
2
1 836856314 1 
2
1 725396791 1 
2
1 305387133 1 
2
1 439460193 1 
2
1 52389779 1 
2
1 135352710 1 
2
1 529781466 1 
2
1 370444521 1 
2
1 237124713 1 
2
1 618523162 1 
2
1 242237830 1 
2
1 742449935...

result:

ok OK (100 test cases)

Test #67:

score: 0
Accepted
time: 144ms
memory: 4284kb

input:

1
1000
0 1758791 2343659 2846474 3434022 7652700 8253080 8682475 9405659 11944176 12562847 12673371 13522295 14858135 15330776 16160812 16635107 16991264 18005152 18032603 18731348 19153452 20937508 22107112 22323639 22588239 23702799 24419196 25155453 26551735 27271506 27468365 28904370 29126794 29...

output:

0
484938557 

result:

ok OK (1 test case)

Test #68:

score: 0
Accepted
time: 145ms
memory: 4340kb

input:

1
1000
1524604 1646846 2338903 2740406 3942040 3989931 5024363 5109527 5196877 5872505 6582352 7777799 8173727 8685410 8915600 9182310 9321306 9464284 9525805 10827313 11808773 11893079 14391976 16125462 16473265 16944637 17943795 18017238 18500810 19091224 19179821 21457416 21539080 21745481 220104...

output:

0
149042459 

result:

ok OK (1 test case)

Test #69:

score: 0
Accepted
time: 145ms
memory: 4396kb

input:

1
1000
773631 1271099 3953765 4084700 5041081 5335552 5576140 6747614 7027757 7344166 7714506 8831964 9790642 9941438 11025187 12106238 12472478 12712903 13529988 14291733 14739211 17428519 20544458 21885207 22200855 23721329 24137389 24680712 26042453 26970932 27063836 27430770 27857078 27978315 28...

output:

1
235190923 235190923 

result:

ok OK (1 test case)

Test #70:

score: 0
Accepted
time: 144ms
memory: 4340kb

input:

1
1000
0 67424 2014750 5012509 6307284 6316493 6351222 7852345 8040778 8084229 10777085 10777154 10905187 11652681 11892364 12234217 13488004 13701500 13776090 14723966 15000536 15200318 15499307 16241329 17620285 19373854 19908820 20557656 21872465 24006771 24260068 24813456 24891673 25743075 26262...

output:

1
472526230 472526230 

result:

ok OK (1 test case)

Test #71:

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

input:

1
1000
2295353 3461456 4344364 5915651 6918566 7393834 9334103 9838123 10830030 13736515 13825479 14606894 16070673 17301962 18487593 18547521 19267440 19932644 21525339 23557043 24224358 24625407 26153155 26665557 28173534 28305507 28493456 28720983 29903553 30478893 30859633 31193386 31656277 3391...

output:

2
789251375 295582233 789251375 

result:

ok OK (1 test case)

Test #72:

score: 0
Accepted
time: 141ms
memory: 4332kb

input:

1
1000
2118267 2380145 2786828 2816505 6241267 6608195 7838712 8323036 10603372 10625540 10883561 12351514 12916606 13062847 13114051 14784771 15245928 15627189 16512688 16525086 16542632 16726071 17007610 17405216 17868667 18079562 18751319 23434852 23589375 24339074 26897701 27646883 31093138 3161...

output:

2
267542375 914240927 267542375 

result:

ok OK (1 test case)

Test #73:

score: 0
Accepted
time: 28ms
memory: 4308kb

input:

1
1000
2708447 2966917 4035173 4113783 4616510 4792495 5218582 5771344 5952018 6723671 8132318 8164009 8353915 8824287 9240372 10058716 11049630 11298497 12239359 12441950 12610699 15604720 16083533 16925855 18316944 18633378 18643929 19334868 22075288 22657887 22674425 23109145 23539733 24928900 25...

output:

9999
48672564 188508987 113028209 83420819 563416085 136125676 269854188 675125414 617229994 996443840 968061640 634882441 82049569 299494159 454204621 855255187 157996433 813826972 947010873 570591816 666891494 320023750 215613609 812639880 547352546 220818145 44153692 940580619 255821931 382797769...

result:

ok OK (1 test case)

Test #74:

score: 0
Accepted
time: 28ms
memory: 4660kb

input:

1
1000
318363 474352 1782864 2683720 2698336 3350190 3592733 4505908 4638998 4960629 5348676 6069010 6109152 7307430 8551335 9499873 9907789 10582983 12892501 13262454 14930949 15272706 15450931 15952341 17698343 18265425 18955758 20234474 20386851 21764708 22654329 22782293 24906330 24925987 250051...

output:

9999
402882921 975619889 660496689 760050100 440455395 928651024 248848709 416235618 475925298 877919216 753408492 458699299 860643023 374345142 233579207 969772886 242312528 560858973 310908039 819204328 693311783 631484592 782616430 460773713 218902364 475925932 751833809 732456631 397205206 71894...

result:

ok OK (1 test case)

Test #75:

score: 0
Accepted
time: 28ms
memory: 4368kb

input:

1
1000
119122 1962488 2520113 3236722 3549078 5229478 6329478 6425296 6790067 7216677 7444198 7726912 7931422 8350259 8354679 9448546 10664660 11021700 11613345 12158834 12180397 12446155 12513227 12983874 14667838 14845483 14951787 15089592 18090127 18470591 19252921 19347773 20431573 20511208 2118...

output:

10000
43225264 739166139 232980329 62926699 584105517 500051402 755619662 362241120 682475861 907093803 599268857 917465754 152605262 145588592 726844200 660189959 147896910 723650845 431285305 314106242 277266620 449124893 338230788 328996309 371039245 113329399 439290552 379390546 635982335 285718...

result:

ok OK (1 test case)

Test #76:

score: 0
Accepted
time: 28ms
memory: 4360kb

input:

1
1000
24334 1888779 3702999 4295872 4749620 5339990 5428511 5484902 7114095 7274890 7781380 8037085 8151255 11084981 12716844 13843875 14580855 16385339 16845446 18032356 19126887 19968256 20794305 20892072 21597280 23555528 24844456 24945341 25206925 25667388 26581006 27063712 27217869 27904065 28...

output:

10000
57524014 954948747 393798765 158307326 239587565 999644030 901249175 861349019 756942223 30743956 659932988 592511436 379208507 74940310 893613696 631017787 16439883 591585929 778540450 798113374 206907345 524212726 59369361 164060623 983553446 882022777 665495836 12599433 182805590 60481565 3...

result:

ok OK (1 test case)