QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#322225#5743. Palindromic PolynomialEverlastingEternityAC ✓156ms6292kbC++143.6kb2024-02-06 15:41:192024-02-06 15:41:19

Judging History

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

  • [2024-02-06 15:41:19]
  • 评测
  • 测评结果:AC
  • 用时:156ms
  • 内存:6292kb
  • [2024-02-06 15:41:19]
  • 提交

answer

#pragma GCC optimize("Ofast,fast-math")
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

bool _u;

typedef long long ll;
typedef double db;
typedef pair <int, int> pii;
#define ci const int
template <class T>
inline void chmax(T &x, const T &y) { if(x < y) x = y; }
template <class T>
inline void chmin(T &x, const T &y) { if(x > y) x = y; }
#define mp make_pair
#define fi first
#define se second
#define pc putchar
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define ppc __builtin_popcount
#define ctz __builtin_ctz
#define clr(a) memset(a, 0, sizeof(a))
#define rep(i, l, r) for(int i = l, i##end = r; i <= i##end; ++ i)
#define per(i, r, l) for(int i = r, i##end = l; i >= i##end; -- i)
#define fsub(T, S) for(int T = S, T##_f = T; T; T = (T - 1) & T##_f)
#define fsubm(T, S) for(int T = S, T##_f = T; T; T = (T - 1) & T##_f) if(T & (T##_f & -T##_f))
#define Sin(S, i) ((S) >> (i) & 1)

char inputbuf[1 << 23], *p1 = inputbuf, *p2 = inputbuf;
#define getchar() (p1 == p2 && (p2 = (p1 = inputbuf) + fread(inputbuf, 1, 1 << 23, stdin), p1 == p2) ? EOF : *p1++)
inline int read() {
	int res = 0; char ch = getchar(); bool f = true;
	for(; ch < '0' || ch > '9'; ch = getchar())
		f &= ch != '-';
	for(; ch >= '0' && ch <= '9'; ch = getchar())
		res = res * 10 + (ch ^ 48);
	return f ? res : -res;
}

const int N = 1e4 + 15, P = 1e9 + 9, i2 = (P + 1) / 2;

map <ll, ll> S;
int n, d, lim = 1e4, nf, ng;
ll X[N], Y[N];
ll g[N], f[N], h[N];
bool ill[N];

bool _v;

ll poww(ll x, ll y = P - 2) {
	ll res = 1;
	for(; y; y >>= 1, x = x * x % P)
		if(y & 1) res = res * x % P;
	return res;
}

ll mod(ll x) {
	return x >= P ? x - P : x;
}

void ins(int x) {
	per(i, n, 1) g[i] = mod(g[i - 1] - x * g[i] % P + P);
	g[0] = mod(P - x * g[0] % P);
}

void del(int x) {
	ll ix = poww(x);
	g[0] = (P - g[0]) * ix % P;
	rep(i, 1, n) g[i] = (g[i - 1] - g[i] + P) * ix % P;
}

void lgg() {
	clr(f); clr(g);
	g[0] = 1;
	rep(j, 1, n) ins(X[j]);
	rep(j, 1, n) {
		ll co = 1;
		rep(k, 1, n) if(k != j) co = co * (X[j] - X[k] + P) % P;
		co = poww(co) * Y[j] % P;
		del(X[j]);
		rep(k, 0, n) (f[k] += co * g[k]) %= P;
		ins(X[j]);
	}
}

#define exi { puts("-1"); return ; }

ll calc(ll x) {
	ll res = 0;
	per(i, d, 0) res = (res * x + h[i]) % P;
	return res;
}

void solve() {
	n = read();
	S.clear();
	clr(ill);
	ll y0 = -1;
	rep(i, 1, n) X[i] = read();
	rep(i, 1, n) Y[i] = read();
	rep(i, 1, n) {
		if(X[i] == 0) {
			y0 = Y[i];
			if(y0 == 0) exi
			continue;
		}
		if(S.find(X[i]) != S.end()) {
			if(S[X[i]] != Y[i]) exi
			continue;
		}
		S[X[i]] = Y[i];
		ll ix = poww(X[i]), y = Y[i];
		if(S.find(ix) != S.end())
			rep(j, 0, lim) {
				if(y != S[ix]) ill[j] = 1;
				(y *= ix) %= P;
			}
	}
	d = -1;
	per(i, lim, 0) if(!ill[i]) { d = i; break; }
	if(d == -1) exi
	rep(i, 1, n) if(X[i]) S[poww(X[i])] = Y[i] * poww(X[i], P - 1 - d) % P;
	n = 0;
	for(auto p : S) X[++ n] = p.fi, Y[n] = p.se;
	lgg();
	nf = ng = n;
	while(nf && !f[nf]) -- nf;
	while(ng && !g[ng]) -- ng;
	if(nf > d) exi
	rep(i, 0, d) h[i] = mod(f[i] + f[d - i]) * i2 % P;
	rep(i, 1, n) assert(calc(X[i]) == Y[i]);
	if(h[0] == 0 || y0 != -1 && h[0] != y0) {
		if(ng > d) exi
//		if(h[0] == 0) y0 = 1;
		ll k = (y0 - h[0] + P) * poww(mod(g[0] + g[d])) % P;
		rep(i, 0, d) (h[i] += k * (g[i] + g[d - i])) %= P;
	}
	printf("%d\n", d);
	rep(i, 0, d) printf("%lld ", h[i]);
	pc(10);
}

signed main() {
//	freopen("yinfuxixuer.in", "r", stdin);
	//freopen("yinfuxixuer.out", "w", stdout);
	int T = read();
	while(T --) solve();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 6128kb

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:

10000
2 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 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 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 (8 test cases)

Test #2:

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

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:

10000
991763663 84183251 817748541 751820472 274705299 514844809 913324462 820197929 612599255 544464585 308799257 597748867 819625620 166080135 361705698 661132829 605251716 496947604 920996634 950546155 264960302 137225471 323125051 668269766 400370855 394998826 746252932 404806900 592103371 32196...

result:

ok OK (10 test cases)

Test #3:

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

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:

10000
595082465 500379518 192552113 852814130 247309815 962855771 99418958 331067561 535148608 579727297 259903516 111909078 37735507 500838722 255719385 725870731 519455673 56193620 436557088 32184394 483678212 529399895 706324015 477741359 718334153 959571726 408401068 308036831 271560940 58661475...

result:

ok OK (1 test case)

Test #4:

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

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
1000000008 457290695 217589796 669877535 123930016 669877535 217589796 457290695 1000000...

result:

ok OK (21 test cases)

Test #5:

score: 0
Accepted
time: 4ms
memory: 3996kb

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
1000000008 236655457 300446642 263038768 777014108 263038768 300446642 236655457 1000000...

result:

ok OK (21 test cases)

Test #6:

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

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
1000000008 40299996 526537806 354472336 100567846 100567846 35447233...

result:

ok OK (21 test cases)

Test #7:

score: 0
Accepted
time: 4ms
memory: 4040kb

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
1000000008 112818847 619867884 878342118 841499980 841499980 8783421...

result:

ok OK (21 test cases)

Test #8:

score: 0
Accepted
time: 4ms
memory: 6004kb

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
1000000008 564477491 591882526 476247739 996380710 476247739 591882526 564477491 1000000...

result:

ok OK (21 test cases)

Test #9:

score: 0
Accepted
time: 5ms
memory: 5948kb

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
1000000008 954084979 53133006 321736971 269434291 269434291 32173697...

result:

ok OK (21 test cases)

Test #10:

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

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
1000000008 290823601 780707534 221461...

result:

ok OK (21 test cases)

Test #11:

score: 0
Accepted
time: 7ms
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: 7ms
memory: 4052kb

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

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: 10ms
memory: 4056kb

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: 10ms
memory: 4036kb

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

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: 71ms
memory: 4192kb

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: 71ms
memory: 6136kb

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: 72ms
memory: 6180kb

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
1000000008 265131588 395364251 9743588 391991332 646826998 287600825 218025961 146567408 311218091 301597000 903630065 47936460 199311997 891373675 737633260 793130126 871088888 903682481 300779631 63964008 695763888 930484417 279985898 591110707 302649016 695580520 807812903 98122818 408441415...

result:

ok OK (1 test case)

Test #20:

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

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
1000000008 50681940 630233051 675833921 860913872 990529797 628611473 317745683 115282799 817490414 962362848 534548870 833355143 640629124 659728048 109150609 353482836 349420422 740437117 737087396 336191700 37340716 909872794 546216582 918409404 26308223 461908532 730121903 33284824 92057581...

result:

ok OK (1 test case)

Test #21:

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

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
1000000008 684241508 118694953 124040977 468020472 634203861 602593629 145833706 457332242 470111821 182038945 58842273 363428386 579286291 975971275 657930849 246968037 900130316 967363943 704774363 175306 305397832 474733746 409058561 740204563 747855546 426233696 463762674 855936871 54913343...

result:

ok OK (1 test case)

Test #22:

score: 0
Accepted
time: 70ms
memory: 4072kb

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: 71ms
memory: 4132kb

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: 71ms
memory: 5992kb

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: 73ms
memory: 4140kb

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: 72ms
memory: 4156kb

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: 73ms
memory: 6136kb

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: 73ms
memory: 5980kb

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: 71ms
memory: 4144kb

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: 89ms
memory: 6168kb

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: 83ms
memory: 4092kb

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: 76ms
memory: 4160kb

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

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: 89ms
memory: 6100kb

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

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: 15ms
memory: 6236kb

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: 69ms
memory: 4004kb

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: 39ms
memory: 3800kb

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

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: 57ms
memory: 3832kb

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

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: 56ms
memory: 3780kb

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: 55ms
memory: 3708kb

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: 88ms
memory: 6068kb

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: 155ms
memory: 4280kb

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: 156ms
memory: 6120kb

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: 155ms
memory: 4340kb

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: 155ms
memory: 4344kb

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: 155ms
memory: 4304kb

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: 95ms
memory: 4168kb

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:

10000
607269005 386098290 233396041 76668883 231300376 135864205 85275496 794891110 593120708 471942070 787214678 519076723 826136623 978277156 532017819 218857727 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 0 0 0 0 0 0 0 0 ...

result:

ok OK (100 test cases)

Test #51:

score: 0
Accepted
time: 155ms
memory: 4296kb

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:

10000
679391945 309620444 531187202 589446891 225412069 714983168 308053704 146330922 489792095 274134966 941281444 416962232 646336988 419622161 138217087 614422473 995713039 624489264 401011251 123292515 114117718 743387882 37561511 527320003 627531474 6483416 345581242 397711608 321555280 8483610...

result:

ok OK (1 test case)

Test #52:

score: 0
Accepted
time: 156ms
memory: 6012kb

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:

10000
636375983 787602522 820493169 46838196 479740053 706093794 862469127 793213981 213846609 564795969 516584370 503017396 54391366 230774943 776837708 260483919 254186859 977831674 746291935 110403520 957085932 839861023 175136558 388514029 297556777 787811059 868185957 595360820 822388385 114339...

result:

ok OK (1 test case)

Test #53:

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

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:

10000
635831945 396358084 137185243 280349439 129386688 939498273 135842614 272662601 371473638 120297030 252101871 809580109 104096602 157292314 449191232 582403425 218834118 255564104 722755066 961479264 639491767 252470578 83697796 384959545 682380019 602262692 669887061 428442116 243518287 26552...

result:

ok OK (1 test case)

Test #54:

score: 0
Accepted
time: 151ms
memory: 4296kb

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:

10000
36681205 597634597 513875496 904379358 14982569 655743579 478110823 399179332 597894627 49776251 428066629 214921091 285231319 40623733 197519688 287043993 728453599 880005188 862090447 352895821 869624017 7175514 454975793 476754608 403801749 490790976 265841328 522322749 723348348 989914621 ...

result:

ok OK (1 test case)

Test #55:

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

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:

10000
495507958 19042963 661114591 616164414 902777750 549705498 647597908 406020354 955523809 297160354 32977193 103063861 93788584 411497266 764752086 833310561 732131055 68228667 430528374 60240084 643976278 569121878 945441923 47421144 522411713 489463517 238497919 118087203 597758524 817392963 ...

result:

ok OK (1 test case)

Test #56:

score: 0
Accepted
time: 155ms
memory: 4272kb

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:

10000
50702826 620042733 894782154 189448226 129828303 531268548 520234984 615884008 706531953 3196099 975328378 743831173 193534732 988259059 882140154 533367334 905133065 276575592 607058093 644333940 576857530 429332192 903263651 283207902 416327557 397895242 416617318 194042302 500219081 2721066...

result:

ok OK (1 test case)

Test #57:

score: 0
Accepted
time: 156ms
memory: 4304kb

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:

10000
865105593 672846573 96281805 836442006 559376114 757490082 908432556 344061485 655392481 753005020 120290803 285648150 651339609 556116759 154553063 737301019 866201801 633680719 141012765 856322284 671363489 24471314 988941562 704656142 121600471 61005080 829374603 144520969 462187680 4286795...

result:

ok OK (1 test case)

Test #58:

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

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:

10000
891403056 116561602 636874864 671992934 724546893 275329938 505576288 878539301 734711651 538833533 91313578 72696646 901407211 170804733 182815064 612312836 757283458 582206172 535508983 827777119 489743179 366929806 694590602 724520143 786478012 14117155 100355297 227292173 29406480 81939406...

result:

ok OK (1 test case)

Test #59:

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

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:

10000
707052565 914634687 654882600 816252287 357451981 153248522 73106756 12090345 436388447 908944102 218332256 218509693 6005387 772388624 132508485 451064558 62375165 11768109 200853547 24096749 230561483 886119748 527341138 243911348 939860718 854493009 133365713 153498150 121245957 4231521 361...

result:

ok OK (1 test case)

Test #60:

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

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:

10000
289288896 463368932 252982914 684360410 856008971 664967208 193235190 231166824 665561889 928453625 864020844 47251013 767738844 884483893 429281886 819045746 765160650 716815992 980938900 426523432 969072771 379383732 594563710 594296387 708186106 99965593 577272426 381315167 338429353 360919...

result:

ok OK (1 test case)

Test #61:

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

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: 87ms
memory: 4136kb

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:

10000
1000000008 78551492 166334288 957453954 166334288 78551492 1000000008 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 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 (16 test cases)

Test #63:

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

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:

10000
1000000008 848813522 150269897 686897543 275009380 544428037 560780315 202935556 80521397 356894017 649903189 9557481 385963241 980439468 315921573 832090714 432067531 885906547 31253084 304629033 583751827 872254458 689268050 810550604 330360804 888067903 460161164 689329768 579999225 5418512...

result:

ok OK (1 test case)

Test #64:

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

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:

10000
1000000008 318495322 579275369 946809100 972260013 697420668 188340305 169366250 796156082 168985261 554436355 657891572 974621295 924387072 194159218 76740282 136126403 807864889 337744342 662647864 35597810 514887951 3151544 758603100 516182471 755451103 444727727 74884301 968405475 61039481...

result:

ok OK (1 test case)

Test #65:

score: 0
Accepted
time: 155ms
memory: 4292kb

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:

10000
800419886 852106701 670934907 583269078 6695014 888946184 856736675 614551637 797100662 558138366 189055476 68293319 503338274 757072023 18396748 499020937 823970546 792875462 892411546 744418859 570155972 496787717 478195184 896802636 447735382 690933056 147549018 557924413 465156864 18790240...

result:

ok OK (1 test case)

Test #66:

score: 0
Accepted
time: 51ms
memory: 4036kb

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:

10000
856547735 964362992 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 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok OK (100 test cases)

Test #67:

score: 0
Accepted
time: 65ms
memory: 4152kb

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: 68ms
memory: 4064kb

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: 66ms
memory: 6116kb

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

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

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: 66ms
memory: 4192kb

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: 129ms
memory: 5936kb

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: 125ms
memory: 4244kb

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: 128ms
memory: 6292kb

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: 128ms
memory: 4316kb

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)