QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#351321#4563. Radio Towerse3c8f1a924100 ✓951ms594824kbC++145.3kb2024-03-11 20:42:122024-03-11 20:42:12

Judging History

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

  • [2024-03-11 20:42:12]
  • 评测
  • 测评结果:100
  • 用时:951ms
  • 内存:594824kb
  • [2024-03-11 20:42:12]
  • 提交

answer

#include "towers.h"

#include <vector>
#include <algorithm>
#include <iostream>
#include <stack>
//#include <cassert>

int mx[20][100005], mn[20][100005], a[100005];
int mni(int x, int y) { return a[x] < a[y] ? x : y; }
int mxi(int x, int y) { return a[x] < a[y] ? y : x; }

int getmx(int L, int R) {
	int t = __builtin_log2(R - L + 1);
	int x = mx[t][L], y = mx[t][R - (1 << t) + 1];
	return mxi(x, y);
}
int getmn(int L, int R) {
	int t = __builtin_log2(R - L + 1);
	int x = mn[t][L], y = mn[t][R - (1 << t) + 1];
	return mni(x, y);
}

int root[100005], A[8000006], ls[8000006], rs[8000006];
int tl[100005], tr[100005], tot, n, cls[100005], crs[100005];
int dfs(int l, int r, int p) {
	if (l > r) return 0;
	int u = getmx(l, r);
	int ls = cls[u] = dfs(l, u - 1, a[u]), rs = crs[u] = dfs(u + 1, r, a[u]);
	tr[u] = p - a[getmn(l, r)];
	tl[u] = std::max(tr[ls], tr[rs]) + 1;
	return u;
}
int clone(int u) {
	tot++, ls[tot] = ls[u], rs[tot] = rs[u], A[tot] = A[u];
	return tot;
}
void insert(int &u, int l, int r, int k, int d) {
	u = clone(u);
	if (l == r) return A[u] += d, void();
	int mid = (l + r) >> 1;
	if (k <= mid) insert(ls[u], l, mid, k, d);
	else insert(rs[u], mid + 1, r, k, d);
	A[u] = A[ls[u]] + A[rs[u]];
}
int sum(int u, int l, int r, int L, int R) {
	if (!u) return 0;
	if (l >= L && r <= R) return A[u];
	if (r < L || l > R) return 0;
	int mid = (l + r) >> 1;
	return sum(ls[u], l, mid, L, R) + sum(rs[u], mid + 1, r, L, R);
}

struct segtree {
	int a[100005], root[100005], tot, b[100005], rootb[100005], tl[100005], tr[100005];
	int A[16000006], ls[16000006], rs[16000006], B[16000006];
	int clone(int u) {
		tot++, ls[tot] = ls[u], rs[tot] = rs[u], A[tot] = A[u], B[tot] = B[u];
		return tot;
	}
	void modify(int &u, int l, int r, int k, int d) {
		u = clone(u);
		if (l == r) return A[u] = d, void();
		int mid = (l + r) >> 1;
		if (k <= mid) modify(ls[u], l, mid, k, d);
		else modify(rs[u], mid + 1, r, k, d);
		A[u] = std::max(A[ls[u]], A[rs[u]]);
	}
	void modifyB(int &u, int l, int r, int k, int d) {
		if (k > r || k < l) return;
		u = clone(u);
		if (l == r) return B[u] += d, void();
		int mid = (l + r) >> 1;
		if (k <= mid) modifyB(ls[u], l, mid, k, d);
		else modifyB(rs[u], mid + 1, r, k, d);
		B[u] = B[ls[u]] + B[rs[u]];
	}
	int ask(int u, int l, int r, int L, int R, int D) {
		if (!u) return 0;
		if (r < L || l > R) return 0;
		if (!A[u]) return 0;
		if (A[u] < D) return 0;
		if (l == r) return l;
		int mid = (l + r) >> 1, tl = ask(ls[u], l, mid, L, R, D);
		if (tl) return tl;
		else return ask(rs[u], mid + 1, r, L, R, D);
	}
	int sum(int u, int l, int r, int L, int R) {
		if (!u) return 0;
		if (l >= L && r <= R) return B[u];
		if (r < L || l > R) return 0;
		int mid = (l + r) >> 1;
		return sum(ls[u], l, mid, L, R) + sum(rs[u], mid + 1, r, L, R);
	}
	void build(int N) {
		static std::stack<int> sta;
		a[N + 1] = 2e9, sta.push(N + 1);
		for (int i = N; i >= 1; i--) {
			root[i] = root[i + 1], rootb[i] = rootb[i + 1];
			while (a[sta.top()] < a[i]) {
				modify(root[i], 1, N, sta.top(), 0);
				modifyB(rootb[i], 0, 1e9, tl[sta.top()], -1);
				modifyB(rootb[i], 0, 1e9, tr[sta.top()] + 1, 1);
			   	sta.pop();
			}
			modifyB(rootb[i], 0, 1e9, tl[i], 1);
			modifyB(rootb[i], 0, 1e9, tr[i] + 1, -1);
			modify(root[i], 1, N, i, b[i]);
		   	sta.push(i);
		}
	}
} B, C;

void init(int N, std::vector<int> H) {
	n = N;
    for (int i = 1; i <= N; i++) mx[0][i] = i, mn[0][i] = i, a[i] = H[i - 1];
    for (int i = 1; i <= __builtin_log2(N); i++) {
        for (int j = 1; j + (1 << i) <= N + 1; j++) {
            mx[i][j] = mxi(mx[i - 1][j], mx[i - 1][j + (1 << (i - 1))]);
            mn[i][j] = mni(mn[i - 1][j], mn[i - 1][j + (1 << (i - 1))]);
        }
    }
	dfs(1, N, 1e9 + a[getmn(1, N)]);
	for (int i = 1; i <= N; i++) {
		root[i] = root[i - 1];
		if (tl[i] > tr[i]) continue;
		insert(root[i], 0, 1e9, tl[i], 1);
		if (tr[i] < 1e9) insert(root[i], 0, 1e9, tr[i] + 1, -1);
	}
	for (int i = 1; i <= N; i++) {
		B.a[i] = a[i], B.b[i] = tr[crs[i]];
		B.tl[i] = tl[i], B.tr[i] = tr[i];
	   	C.a[i] = a[N - i + 1], C.b[i] = tr[cls[N - i + 1]];
		C.tl[i] = tl[N - i + 1], C.tr[i] = tr[N - i + 1];
	}
	B.build(N), C.build(N);
}

int max_towers(int L, int R, int D) {
	L++, R++;
//	for (int i = L; i < R; i++) if (a[i] > a[i + 1]) return -1;
	int ans = sum(root[R], 0, 1e9, 0, D) - sum(root[L - 1], 0, 1e9, 0, D);
	int u = getmx(L, R);
	int l = B.ask(B.root[L], 1, n, L, n, D), r = n - C.ask(C.root[n - R + 1], 1, n, n - R + 1, n, D) + 1;
	if (!l || l > u) l = u;
	if (r > n || r < u) r = u;
//	std::cerr << l << " " << r << " " << u << std::endl;
//	std::cerr << L << " " << R << " " << D << std::endl;
//	std::cerr << ans << std::endl;
//	std::cerr << D << " " << tr[getmx(L, R)] << " " << tl[getmx(L, R)] << std::endl;
	if (l != L) {
//		int _ = B.sum(B.rootb[L], 0, 1e9, 0, D);
		int t = getmx(L, l - 1);
//		assert(0 <= _ && _ <= 1);
		if (D <= tr[t] && B.sum(B.rootb[L], 0, 1e9, 0, D)) ans--;
		if (a[getmn(L, l - 1)] <= a[l] - D) ans++;
	}
	if (r != R) {
//		int _ = C.sum(C.rootb[n - R + 1], 0, 1e9, 0, D);
		int t = getmx(r + 1, R);
//		assert(0 <= _ && _ <= 1);
		if (D <= tr[t] && C.sum(C.rootb[n - R + 1], 0, 1e9, 0, D)) ans--;
		if (a[getmn(r + 1, R)] <= a[r] - D) ans++;
	}
//	assert(ans >= 0);
	return ans ? ans : 1;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 262ms
memory: 283320kb

input:

59640
49885 57346 58504 87383 113182 129676 204090 205404 259925 276583 300332 324014 333675 359377 364049 408489 414852 428310 438038 440113 458193 554789 643468 666525 683112 690791 707313 720088 741028 748785 789826 796576 800966 832867 851750 861044 862283 900756 926925 939560 955678 965636 9740...

output:

1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 47004 lines

Test #2:

score: 0
Accepted
time: 545ms
memory: 477848kb

input:

100000
2578 13067 19114 20399 28997 31651 32660 44354 74124 80988 88107 95439 96029 102645 103539 132139 137628 158023 174859 192033 205256 217839 227259 243992 248025 260099 283750 285030 294864 297371 303073 333910 343091 343725 359151 361656 361691 386777 414415 419149 425074 433963 447813 448681...

output:

1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #3:

score: 0
Accepted
time: 505ms
memory: 476924kb

input:

100000
13114 25925 27245 67202 68073 76184 110151 123581 140992 143871 146221 155748 165589 167167 168714 171437 172941 193840 194941 197306 200400 218140 230901 232201 246351 256019 260798 270505 295025 297243 308012 322193 346038 355192 366304 396540 414362 422681 428999 432243 434231 444296 47452...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #4:

score: 0
Accepted
time: 383ms
memory: 477876kb

input:

100000
5700 16956 35944 39194 51761 52173 81805 105452 109633 118593 123359 137554 140598 144792 159902 205292 216922 221444 228388 264645 275797 312855 317157 317211 346139 386655 414208 420637 428337 428731 441479 462812 473900 512659 530585 531009 539066 541910 546178 587753 622729 662273 672038 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #5:

score: 0
Accepted
time: 398ms
memory: 477176kb

input:

100000
999988197 999986623 999976776 999962270 999951065 999947015 999903896 999903807 999891790 999885112 999877561 999867525 999861234 999819451 999804835 999800656 999792796 999785754 999774226 999765965 999763733 999757041 999755039 999754683 999735689 999725096 999723596 999697826 999692425 999...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #6:

score: 0
Accepted
time: 449ms
memory: 477068kb

input:

100000
6846 27030 27974 37358 50621 62404 65145 70521 83772 99764 103069 115739 118757 122093 131124 161358 163926 192258 220922 221834 229360 240485 256289 274164 288418 297330 299248 304572 312235 330527 340606 343538 347549 349819 381756 399043 400603 401181 403223 405524 426129 429182 440198 440...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #7:

score: 0
Accepted
time: 329ms
memory: 477172kb

input:

100000
999993000 999985279 999974372 999973105 999972338 999935099 999930231 999929661 999915510 999914373 999909600 999909476 999902789 999890841 999821968 999815754 999785501 999754085 999740116 999733261 999721841 999718823 999718208 999711968 999704389 999695063 999684278 999682448 999663281 999...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Subtask #2:

score: 11
Accepted

Test #8:

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

input:

425
753881706 405729786 890889563 29736246 598281970 208352067 357783003 663497023 178397034 4832890 562140755 510307001 354540290 538848551 436879256 86659033 42928516 24145404 749159097 118423198 506851985 204895765 719719998 726244368 991372008 681703480 799303017 657138050 88278945 417801236 260...

output:

13

result:

ok 3 lines

Test #9:

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

input:

2000
510696791 617882876 373405425 518361747 407161508 435668375 559543221 465317236 38039460 717410075 714427583 977153243 679286738 23933545 750215417 37078782 973334934 244734879 243897181 603105656 981870220 85688930 807317304 901266308 225354691 737318933 824323690 365669439 111883771 153256479...

output:

292

result:

ok 3 lines

Test #10:

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

input:

2000
516351740 512181903 200723571 993230512 160881035 858124753 539677115 120758992 855511696 883443323 930303372 707938300 186981787 145199071 581235758 65550786 7197175 474759320 732341567 517832089 220614631 428681162 168642809 331743780 689236970 514407524 725936494 447118446 628858360 36946526...

output:

91

result:

ok 3 lines

Test #11:

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

input:

2000
9654673 812116916 373455422 816862897 353222263 785552601 262143032 654718863 361397545 763154940 79011466 983035671 46521930 654559175 371270845 610911343 19671952 831534324 157278884 850193672 83857278 600512673 91419235 820220378 19933790 959137813 447541847 957882585 47577396 981451791 2290...

output:

336

result:

ok 3 lines

Test #12:

score: 0
Accepted
time: 8ms
memory: 15052kb

input:

2000
101597651 901337214 94865893 515541321 223422476 791229261 361846447 652989994 147299317 644867197 32737606 525776949 182468296 547470985 330848340 873710937 392296086 971753844 156102346 764082424 254318166 685488259 221310405 521552461 481853974 868664461 300437861 938093383 466194541 6653033...

output:

176

result:

ok 3 lines

Test #13:

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

input:

2000
472936055 973169917 157888070 752944598 254539436 814034071 26698036 538887055 429236303 861439585 333049317 960563190 374468157 913310144 89434192 863875353 370790916 558434605 461824050 727741912 341709750 906272885 334496641 886737508 281651305 854169557 304260640 494128561 360711440 5339229...

output:

130

result:

ok 3 lines

Test #14:

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

input:

2000
448125011 914906568 342296305 596847215 308205069 607246435 321988425 906263458 12754675 760166384 151837669 976756930 492753133 973159665 56759675 984884487 393926205 542913032 452064909 641120579 160301206 621818390 240470745 728458832 262255458 718912726 467544291 738536144 174343867 6066620...

output:

34

result:

ok 3 lines

Test #15:

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

input:

2000
63119 1763800 2560156 2577120 2947719 4220876 4493280 5257204 5695924 6255528 6688141 6874164 6986335 8608902 8655716 8667255 8733692 9297137 9612369 10639944 11677890 11850447 12123475 12942200 13292330 13630586 14006505 14704409 15864169 16065863 16090141 16348841 16582396 16707789 16914115 1...

output:

1

result:

ok 3 lines

Test #16:

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

input:

2000
999953545 999809722 999269748 998652085 998032618 997532818 996831561 996646538 995713640 994955665 994498039 993763043 993402749 993344498 992641411 991413401 991243813 990462579 989638909 988726451 988562857 985375670 983150768 982174289 982096151 981854907 981126710 980498905 979609052 97882...

output:

1

result:

ok 3 lines

Test #17:

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

input:

2000
513304 679545 683376 1330519 1389514 2537850 2773316 2812312 3237767 3896687 3989417 4104806 4468408 4893577 5094758 5322413 6269737 6564230 7102596 7379997 7942696 8362867 8543645 9336109 10288566 10317516 11169045 11188413 11774267 12334498 13040401 13398797 13472581 13524263 13682076 1493169...

output:

1

result:

ok 3 lines

Test #18:

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

input:

2000
999767480 999639155 999609042 998925691 998464928 996821425 996683829 996595059 996326912 996298094 995988614 995835236 995756420 994911243 994766270 994353107 994313741 994155172 994005150 993901305 993851772 993130682 993058863 992579160 992456330 992062631 991583495 991577017 991508098 99132...

output:

1

result:

ok 3 lines

Test #19:

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

input:

5
1 3 5 4 2
1 3 1
-2 -2 -2
-2 -2 -2
-1 -1 -1

output:

2

result:

ok 3 lines

Test #20:

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

input:

2000
2864867 4393346 8810369 10207341 13590139 13917112 14896351 15147853 20101448 21379352 22090206 23288189 23589362 23944328 26240608 27933494 30968870 36267127 36364994 38208187 38368254 42600803 42837826 44065373 44518670 51922037 56670571 58860102 59719065 64443762 68818951 71935230 75488444 8...

output:

1

result:

ok 3 lines

Test #21:

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

input:

2000
999760365 998999673 998135281 997844414 997803038 997402755 997139023 997116579 996760663 996722183 996505625 996458058 996210869 996075186 996066073 994149260 993715588 993676466 993655905 993082421 991612027 990710609 990463448 990116777 988414051 988167503 987999136 987879309 987197011 98706...

output:

1

result:

ok 3 lines

Test #22:

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

input:

2000
158938328 621066509 269484140 904716370 139334670 245496632 263105804 6079993 710962096 257464381 612375466 473380320 466047916 2811339 216945685 339797759 216334021 277582256 642097167 429466766 233888460 525812254 672999308 768977991 684199656 167081449 228642547 494801576 265253327 799450311...

output:

79

result:

ok 3 lines

Test #23:

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

input:

2000
359644685 703734272 377862023 641893808 143410877 977707061 179250195 977026605 363644192 526819838 54306668 560233146 51738929 592499153 335983810 971739801 376096378 595674757 203468917 656585670 483673011 620618118 214853234 653740394 344634953 963491779 15077596 563898703 68485795 894047611...

output:

738

result:

ok 3 lines

Test #24:

score: 0
Accepted
time: 8ms
memory: 17052kb

input:

2000
274918408 926448247 101747394 698272164 413668405 951231007 90273823 610561989 383171183 736623499 340218995 929415027 286198184 851805443 301639576 622897418 453403720 716417420 112284375 966699225 217832616 568879951 128445072 537355265 79961425 846295606 264502249 565378787 58241482 60245516...

output:

275

result:

ok 3 lines

Test #25:

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

input:

2000
999543875 998401311 997228478 996982580 996953622 996680623 996493278 996430771 996168915 996133464 995910201 995495403 995029376 994538854 994356013 994339884 994213270 993793205 993318864 992639646 992561744 991783149 991553400 990662346 990614208 990246096 990205513 989843013 989603902 98949...

output:

1

result:

ok 3 lines

Test #26:

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

input:

2000
97693 316539 803236 1779426 2152902 2965818 3685622 4836865 6780301 6847900 7020090 7186755 7870315 8106356 8614799 10629612 10777081 10963313 11183317 11446857 11840148 13231091 13237840 14290924 14355038 14374584 15527125 16050083 17664481 18314750 19666607 20290382 20807669 21026464 21578348...

output:

1

result:

ok 3 lines

Test #27:

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

input:

2000
727710086 780139859 677203358 181956736 286703701 116570936 357010406 755277395 393564114 32547148 250504125 453918118 862819302 675624697 940242753 96785309 24513843 52289009 732527849 211699785 628179030 909281138 691304647 488343010 478031652 683768193 173263301 386737166 537193966 391307824...

output:

670

result:

ok 3 lines

Test #28:

score: 0
Accepted
time: 8ms
memory: 18524kb

input:

2000
33815833 542923331 300887504 739844428 376045390 868330148 495545978 851557510 404790392 979842344 111668597 553358192 449185089 809474976 364826237 835322881 481756945 630783273 113708281 580426744 211174921 660021127 155772259 888525534 82767103 697158115 47139921 947493036 418538044 87136554...

output:

1000

result:

ok 3 lines

Test #29:

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

input:

2000
60604602 655118152 200152149 763099825 72662101 871084501 387352117 966957060 100849937 895167791 76425600 931301097 210114664 759778159 355477403 853342388 453653511 900772156 469128723 576400668 15345685 648798285 284571017 669089083 140673762 677268969 124811359 645329966 307478491 811573113...

output:

1000

result:

ok 3 lines

Test #30:

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

input:

2000
998992835 998647994 997797007 997324084 997284164 997160370 996991225 996464975 995951282 994999185 992539195 991842012 991661197 991447126 991358231 991127617 990303081 988676677 988634240 988623642 988425967 987678183 986335227 986003921 985860328 984629267 982792258 981807277 981669981 98051...

output:

1

result:

ok 3 lines

Test #31:

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

input:

2000
24639 286326 1312015 1509380 2478473 2576331 4119330 4980462 5029392 6349278 6882386 6977265 8261280 8322679 8636798 9341017 9694336 13490026 16368604 16905457 17042276 17184517 17281484 17304972 17613602 18483929 18830930 19801842 20177516 20198093 20497143 21295463 21353981 21465065 21663986 ...

output:

5

result:

ok 3 lines

Test #32:

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

input:

896
508914685 950979790 172424465 965511698 420540781 262980933 257496294 753767238 546972145 513258270 766261434 934053985 521082196 792280493 730134796 518498127 57334998 291152390 408110825 423135711 137164646 586247999 719640627 505791999 109848039 714601649 768140766 275711489 645079915 7606835...

output:

34

result:

ok 3 lines

Test #33:

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

input:

2000
954370524 377190793 766259243 344993099 167089609 39810 600020855 187898584 982599661 948684690 425169536 804182338 483576428 424317475 918106308 910444564 394638067 214932276 98061294 836591638 721427448 645024673 140323089 708762247 589992956 199366752 882109932 680224866 158343370 177501631 ...

output:

153

result:

ok 3 lines

Test #34:

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

input:

2000
960025473 271489820 448353198 969604968 923068593 422496188 580154749 843340340 800071897 262201586 493561677 829934691 696304182 690807193 749126649 791432920 281016660 857281580 586505680 456350775 109914963 840533257 501648593 139239719 53875235 976455342 931206384 761673874 675317959 503642...

output:

422

result:

ok 3 lines

Test #35:

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

input:

2000
222352673 701021504 49588498 584295046 138803159 967922576 19577203 544071071 236487957 556013414 304155111 723083792 59961240 538376264 208302692 594331770 385096003 677931229 149162566 700874934 65563246 863353247 30941830 999244376 262505090 614295592 19389185 671344230 392056889 967901664 4...

output:

380

result:

ok 3 lines

Test #36:

score: 0
Accepted
time: 8ms
memory: 17112kb

input:

2000
112345869 592550296 12582012 651036940 62269171 717753979 362857832 809169454 39104194 528546611 357495551 543926792 124950694 834115502 119806149 945934658 402803957 954320750 419022173 992594379 64295636 999973468 461608728 858525666 199892136 996417868 224122557 747502430 495580205 515760922...

output:

466

result:

ok 3 lines

Test #37:

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

input:

2000
88438379 985670200 210433606 538551487 131199563 772588384 179015543 537394046 80932007 989822412 485940021 842540800 439780553 671274457 85420639 736214435 362159903 868083918 276042295 511854344 25568321 863928382 415270971 803397948 162142390 801005906 136991929 612529286 160087285 967069553...

output:

206

result:

ok 3 lines

Test #38:

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

input:

2000
48427571 606119650 374510465 866934978 455550276 556921037 355254236 963346357 93437384 759895166 246709958 639755067 64844640 731119367 471748204 786457845 368601072 768674020 482176017 719695254 75221674 776433417 518334434 554127730 505857969 676971759 105860311 998773515 119484448 557927039...

output:

260

result:

ok 3 lines

Test #39:

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

input:

2000
654028 839352 1473945 2848149 3457395 4383124 4690374 4837547 4905727 5712852 5930233 6465880 6466618 7298560 7982495 9752751 10433660 10448024 11016930 11470575 12424686 13007835 13229308 13349135 13561936 13812087 14690793 15072031 17155902 17194907 17259603 17596205 18124515 18705749 1995223...

output:

1

result:

ok 3 lines

Test #40:

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

input:

2000
998386922 997473527 996666363 995006492 994924532 994843631 993733996 993467847 993407871 992635144 992099508 991999680 991652687 991214170 990170287 989855622 989456663 989419075 988951324 988124095 987648622 987122274 986970481 986167349 985466413 985224384 985219860 984168750 984084244 98369...

output:

1

result:

ok 3 lines

Test #41:

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

input:

2000
711095 1021095 1145756 1446031 1901770 2166976 2340602 3681515 4122678 4244456 5048255 5104979 5114586 5409856 5913655 5996888 6051190 6614480 7201652 7309546 7506686 8712565 8973966 9526366 9620761 10318148 10452070 10664914 10886810 11129303 11935955 12881725 13358900 13879469 13881202 144640...

output:

1

result:

ok 3 lines

Test #42:

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

input:

2000
999080150 998924650 998756163 998199572 996970216 996445167 995483650 995377744 995033336 994356447 994330300 994283793 993927308 993171717 992815228 992800552 992568400 991298818 990325373 990173121 990027375 989973698 989543426 989396281 989021441 988559241 988407728 987974412 987646293 98715...

output:

5

result:

ok 3 lines

Subtask #3:

score: 12
Accepted

Dependency #2:

100%
Accepted

Test #43:

score: 12
Accepted
time: 258ms
memory: 384872kb

input:

65076
604676696 423118410 564678886 369832239 984799638 664620633 510599965 415614079 160352783 150426542 29398773 576003056 217024519 68460187 536508550 695688755 632741816 575256828 37809537 438079521 993476763 36711290 182274162 457978366 735319199 637287621 177038334 200349879 855842670 28208763...

output:

5765

result:

ok 3 lines

Test #44:

score: 0
Accepted
time: 380ms
memory: 593780kb

input:

100000
722209632 968678230 29163131 133737515 297984678 780864362 75335987 520897699 652764725 332842680 983290179 487888929 963363276 31465945 994269970 468574440 165476805 986539150 34646845 958417673 995433554 926912771 796549083 986579356 603658434 323848463 39666113 509133827 681907387 39170904...

output:

2946

result:

ok 3 lines

Test #45:

score: 0
Accepted
time: 358ms
memory: 593756kb

input:

100000
916030974 106510689 671158974 993685088 641139647 11976715 158729380 641320374 747570937 671810804 423238411 120475394 25736291 107963091 428220385 505125304 252773746 333837484 82793326 723602489 169690000 882299659 657745299 677106959 855510885 283324744 191623946 465083950 261315088 437881...

output:

3061

result:

ok 3 lines

Test #46:

score: 0
Accepted
time: 393ms
memory: 593332kb

input:

100000
380673038 860803279 363177023 912563954 317111436 684441305 242642621 655217689 460816498 507811865 266959811 743085697 250238120 636067536 219903651 656179258 354703779 889678433 423750617 820397434 378066292 637632026 333031049 958763418 101231662 636367902 360169824 640059927 375914105 742...

output:

678

result:

ok 3 lines

Test #47:

score: 0
Accepted
time: 385ms
memory: 593548kb

input:

100000
372059302 950023577 289975803 658679885 451421816 898686373 185175298 570274704 417909653 865651319 249466820 564597937 400563987 899859391 145688415 795914418 105608543 879826999 30975940 820084679 3872543 884623089 351090508 899459265 75149934 734048865 20518289 620792201 102719733 54600412...

output:

5197

result:

ok 3 lines

Test #48:

score: 0
Accepted
time: 403ms
memory: 593560kb

input:

100000
21856280 644709092 461978931 585129456 17813317 730789381 123884229 968401468 422262465 878598590 87555377 710863808 66667305 692771179 429812953 771784039 174837276 731219535 27168526 667284136 104886563 611749430 26893404 523067838 359018911 555087475 234502324 964046474 408279254 503222008...

output:

19199

result:

ok 3 lines

Test #49:

score: 0
Accepted
time: 376ms
memory: 593848kb

input:

100000
308141004 963592931 258194609 799387904 23154205 652020827 322795894 854542634 378177440 863851762 31894940 807128991 177340883 912873417 329480888 508464761 249511237 737968546 453573492 571562905 44908584 774551307 91940747 826003353 419108658 933433319 437960080 749991900 284072608 9504892...

output:

1030

result:

ok 3 lines

Test #50:

score: 0
Accepted
time: 209ms
memory: 476972kb

input:

100000
192 7402 8626 22108 40620 46979 52652 60701 61720 67104 70493 79076 80568 88063 99138 124600 135732 136866 143926 150950 165627 175803 185671 207929 213464 216389 306088 322431 333249 333593 342181 346334 388545 391276 401746 404893 436784 443716 463524 468758 475716 486897 515912 517590 5332...

output:

1

result:

ok 3 lines

Test #51:

score: 0
Accepted
time: 223ms
memory: 476980kb

input:

100000
999999365 999988670 999986348 999947263 999927707 999921971 999879650 999872737 999861388 999841707 999840787 999830711 999810945 999796457 999795770 999795725 999788828 999777546 999749701 999746824 999741689 999723881 999723835 999719965 999700066 999678350 999671531 999646208 999635599 999...

output:

1

result:

ok 3 lines

Test #52:

score: 0
Accepted
time: 237ms
memory: 539556kb

input:

100000
23918 24674 34885 45972 53733 56634 57474 67973 82695 94202 96387 117962 121731 123023 125238 128478 137345 167850 168600 179440 194130 195546 199717 212733 217450 217853 217953 230129 230697 238137 256025 257612 270720 272179 276308 278072 294727 305334 312730 315309 358875 377515 381816 388...

output:

1

result:

ok 3 lines

Test #53:

score: 0
Accepted
time: 249ms
memory: 525988kb

input:

100000
999982008 999970745 999959052 999956794 999951621 999944607 999925528 999897018 999893282 999892846 999887185 999883475 999882267 999880726 999863359 999847670 999843119 999841707 999835493 999828404 999802816 999781953 999770515 999759235 999751129 999738787 999729943 999729658 999723089 999...

output:

1

result:

ok 3 lines

Test #54:

score: 0
Accepted
time: 379ms
memory: 574008kb

input:

96600
988224948 851924696 912467649 897326461 867920567 658494787 719742570 325885057 228778638 18435002 724431257 494352719 939187143 142768213 433716023 415792257 780201523 482280768 351425421 821272036 511291684 540737272 926129286 141883572 367808943 963325580 621883376 99808738 972103915 988618...

output:

11795

result:

ok 3 lines

Test #55:

score: 0
Accepted
time: 396ms
memory: 593032kb

input:

100000
236938416 720682688 724676411 713108946 717801227 90102100 992635962 147019588 580678900 283929274 494342542 996713288 231106479 854078077 21406380 504188292 564819698 133711082 183779484 263256189 820444965 697660239 364860471 47597018 382957986 718842429 258357352 579606693 657034997 416878...

output:

18660

result:

ok 3 lines

Test #56:

score: 0
Accepted
time: 385ms
memory: 593124kb

input:

100000
244852821 762465363 551994558 337720815 766488051 512558478 972769856 97428639 398151136 892413466 710218331 22465641 736542073 680376308 852426721 385176647 746165587 363735522 819707519 883015326 206673024 40652471 578702328 328331386 994323912 790898316 159970156 661055700 468976882 595535...

output:

25004

result:

ok 3 lines

Test #57:

score: 0
Accepted
time: 358ms
memory: 593776kb

input:

100000
73989567 670253961 362188022 987855722 335181787 979852801 434509461 499653547 292001497 864837107 174453616 529508213 139406635 623677551 461740688 864605718 479648821 687331595 323366754 728325614 98277326 775773291 342632693 891883838 220581595 553444118 439641661 614120520 36155160 653106...

output:

49981

result:

ok 3 lines

Test #58:

score: 0
Accepted
time: 400ms
memory: 593416kb

input:

100000
54441555 684274690 114163181 708080507 393253127 597428540 26499136 598305455 422260335 773051661 450866557 745000848 313554122 823278256 320894700 961361741 60158507 650062425 74753088 570357816 111904831 698242708 235680281 866693815 307337581 761943044 343439004 632179980 190390516 5463546...

output:

41896

result:

ok 3 lines

Test #59:

score: 0
Accepted
time: 385ms
memory: 593796kb

input:

100000
69161615 831306962 435918021 931849786 304319355 530137598 354584427 941032593 304025652 921970285 350396425 780119544 475918935 539267546 10164844 626822272 194091185 749245433 383725232 548229408 152819620 782002334 467051199 689368726 262396503 647475296 432553111 800498003 352864317 99614...

output:

29398

result:

ok 3 lines

Test #60:

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

input:

100000
217492608 920527261 66160166 915323688 197918934 737308592 263605946 526386116 199037231 513959960 463164195 884877591 424972438 924867339 67142685 708649945 399810682 877962806 325474634 584928514 405194630 981219133 82565302 684812736 351839737 768122180 210863485 707428185 224460779 870431...

output:

42995

result:

ok 3 lines

Test #61:

score: 0
Accepted
time: 172ms
memory: 477668kb

input:

100000
29541 31727 37931 48305 48666 62174 64265 68049 77168 86355 97666 102292 102957 110596 136282 174926 191378 199152 200284 210143 213409 220351 244400 245453 247703 249638 266141 308269 309805 326215 350546 356045 369569 379682 383547 384324 392144 392473 392744 395575 403872 414922 423756 427...

output:

1

result:

ok 3 lines

Test #62:

score: 0
Accepted
time: 205ms
memory: 477860kb

input:

100000
999996618 999995537 999986343 999967467 999961226 999959443 999924338 999902837 999897768 999861194 999854093 999850159 999837954 999836785 999813526 999801533 999774870 999762452 999728364 999721495 999719444 999709035 999686396 999685472 999670585 999664005 999639567 999636516 999626306 999...

output:

1

result:

ok 3 lines

Test #63:

score: 0
Accepted
time: 252ms
memory: 560060kb

input:

100000
16638 22616 31252 34567 41875 46987 50782 61456 67097 101154 119075 130414 132011 143935 183762 193445 199756 202140 225155 237892 260223 265446 285045 310511 313080 313702 317372 337104 341056 365379 365454 366133 375291 383302 390460 414774 415286 425597 427063 441488 442498 447941 451467 4...

output:

5

result:

ok 3 lines

Test #64:

score: 0
Accepted
time: 201ms
memory: 484000kb

input:

100000
999978691 999977628 999976313 999971172 999956214 999954285 999935188 999935091 999921615 999921271 999909015 999908207 999904772 999901510 999889655 999885332 999884727 999877857 999870586 999865982 999858351 999850003 999834076 999831295 999827126 999800066 999798303 999794614 999791291 999...

output:

1

result:

ok 3 lines

Subtask #4:

score: 14
Accepted

Test #65:

score: 14
Accepted
time: 646ms
memory: 589864kb

input:

99308
491693640 24020487 317364185 726230755 737284540 951143270 709116045 641023337 360629062 964879440 47884022 532494780 803629825 635450854 688041998 573937055 113198481 191311841 929603572 636688 598629732 895342035 396521271 619919754 716589045 657789547 373121546 866402108 609316614 60046511 ...

output:

11903
4770
14278
13956
571
9308
4389
9
22097
16784
26037
2813
8487
16602
2029
6158
17236
29707
19863
12083
20816
18090
4195
11612
4623
6658
7660
624
9839
13012
14475
11799
14795
6365
7308
5981
13614
14208
15922
17325
6020
10291
1819
29076
3117
6638
5810
28747
14944
9541
5498
1015
5001
20938
305
1993...

result:

ok 76385 lines

Test #66:

score: 0
Accepted
time: 736ms
memory: 593208kb

input:

100000
646527498 970130195 879656883 854139882 920539450 14492099 70829155 825526447 519236533 385324961 763550841 616593724 202907362 504717767 861551686 907280958 806537098 75704450 554965405 422432432 940208667 752899470 775720977 966726690 961764576 993069149 823583546 69522676 360505418 7633091...

output:

14639
9186
584
818
3164
16444
1579
16458
6571
5493
20925
3038
3459
7677
14998
8753
2530
12026
13859
985
3177
296
398
6246
6210
6153
7709
24258
1152
3748
7952
8080
13438
5107
1161
4986
23542
15941
18037
791
15601
8274
3031
13339
8920
8559
11180
24013
394
8673
4017
6704
6973
210
2085
8072
3422
6896
10...

result:

ok 100002 lines

Test #67:

score: 0
Accepted
time: 687ms
memory: 593308kb

input:

100000
799666095 11912869 1942326 329008647 676518434 731915773 50963049 775935498 336708769 698841857 979426630 497121885 413375659 771207486 690312572 933493505 987882987 160504698 336117631 191934672 178953077 95891702 137046482 542428354 425646854 622674091 727455806 150971684 875220551 94422593...

output:

3359
5788
2636
4749
12929
3462
9867
19742
27431
10049
6507
21413
26395
16171
1065
1099
6059
3852
827
8338
4447
19422
6687
18554
12713
17167
17551
6782
6320
12234
14788
9130
5326
19419
3788
8
4527
7191
2972
21849
17183
18614
8536
21210
4177
6455
5606
163
18117
7891
14769
7953
1074
4478
11977
29196
40...

result:

ok 100002 lines

Test #68:

score: 0
Accepted
time: 730ms
memory: 593404kb

input:

100000
309383765 818406090 14295145 629135702 209715251 509716889 12520088 913509863 261355145 755723016 134249674 908312702 67849537 765830435 242732056 593027397 386060391 727871977 280196624 593068179 108402646 788956280 297991891 717564506 119204481 557237512 343638543 799142578 267285209 810194...

output:

23097
5447
23783
27586
952
21564
3870
8703
21117
7700
11000
20983
38022
2663
941
11454
2759
11174
36632
8509
16858
40362
25309
12070
32624
30796
9202
7175
11966
11519
16231
6793
36568
6656
25316
20825
14867
22408
3890
4120
1635
13839
29293
20761
28612
2624
9766
31836
8423
11943
11214
14008
661
8133
...

result:

ok 100002 lines

Test #69:

score: 0
Accepted
time: 647ms
memory: 593596kb

input:

100000
398604064 517084515 403316469 941093925 341076538 763446081 355078186 592439416 478732289 646978211 411743599 905272211 443935337 593019442 240172880 860046653 35947342 589508481 340756803 701412642 475907286 706217099 208187382 909958202 390508631 817202038 114304432 775409240 89780581 53218...

output:

24400
36714
13886
14509
36820
1421
7548
27671
1349
26896
5653
25203
6164
5360
21403
33193
8148
7314
39871
8396
17198
6121
1871
1497
4763
30054
5495
31727
24694
45309
25900
28269
6858
9003
2063
4238
44756
22939
13667
25304
24777
19243
2781
36090
7651
12367
47033
6413
11981
4430
7511
25676
32483
36198...

result:

ok 100002 lines

Test #70:

score: 0
Accepted
time: 773ms
memory: 593412kb

input:

100000
470436767 754487792 461866345 963898735 349595303 728616335 250549334 578810355 347325118 804024766 15413294 787037528 105324976 872668363 473184954 707188829 464977606 782556528 256065321 752907482 412827734 758149764 362598737 510432812 220636665 831053655 189976212 708640841 59667440 87439...

output:

4031
19471
10612
11305
29772
29874
21670
2464
5310
25620
24369
6447
795
10520
18039
1110
11300
7418
19857
3817
7976
14218
18688
45775
31258
24208
13949
1287
11237
32270
34202
9525
38736
11963
21324
21122
13715
45274
28148
26076
726
24521
11067
20365
5491
7039
20594
14715
4222
15081
3768
12930
11824
...

result:

ok 100002 lines

Test #71:

score: 0
Accepted
time: 690ms
memory: 593516kb

input:

100000
412173417 598390408 450506026 862926714 62758084 584835820 312278703 842539009 241894641 534565458 27030476 943943695 471359870 991029867 307671828 975813712 466428149 865400208 101594411 879257618 112546625 917139766 242222832 744966595 51074647 579442498 239653108 584603561 477338553 655568...

output:

33924
11012
17217
5652
35774
19773
7167
16147
4921
22378
2886
6381
20729
25984
37105
33701
12765
15814
31567
4523
3853
2591
5038
24440
15123
29860
5543
28365
21666
6416
7901
16121
5444
18700
17557
8004
9915
26519
5987
605
7786
4804
4099
16672
20783
5924
44630
21907
44651
18917
6041
5328
4338
15527
3...

result:

ok 100002 lines

Test #72:

score: 0
Accepted
time: 417ms
memory: 476896kb

input:

100000
2879 32457 32800 34124 37088 65871 67630 69007 70609 76863 96036 96369 96565 105168 106207 119568 120684 131675 139246 156582 157087 161216 175779 185692 192424 252496 261161 268435 272206 274575 290650 292159 302124 302145 323135 347536 353475 358692 362164 370878 382914 383697 387884 395290...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #73:

score: 0
Accepted
time: 364ms
memory: 477440kb

input:

100000
999980337 999975418 999972304 999917615 999913600 999911365 999900298 999895568 999873059 999868465 999863826 999863630 999862039 999833583 999826253 999820741 999808163 999794394 999788715 999775323 999771102 999765847 999750783 999746445 999710318 999708459 999707434 999695764 999679223 999...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #74:

score: 0
Accepted
time: 464ms
memory: 514580kb

input:

100000
2635 21487 31880 36169 36537 36733 50286 55501 101667 105396 109937 125176 130431 131349 131526 133585 145149 148230 148497 181038 199372 208320 214709 228385 229354 234058 246813 259715 259821 304855 307878 319123 322813 329890 338817 340380 349808 359373 361892 364235 365371 367741 392751 4...

output:

1
1
5
1
1
4
4
2
2
5
4
2
4
2
1
5
5
5
4
2
1
1
1
1
1
2
4
3
4
4
3
2
1
5
1
5
5
1
2
4
5
2
5
5
3
2
2
2
5
4
2
5
5
5
5
1
1
2
1
1
4
4
5
5
4
5
1
5
3
2
4
1
1
5
1
2
3
2
1
1
5
5
2
2
5
1
1
1
2
4
4
5
1
1
4
1
2
2
3
5
1
4
1
2
5
4
1
2
1
1
5
1
4
5
1
1
4
4
4
1
4
3
1
2
5
1
5
2
5
2
1
4
2
1
3
5
1
1
2
2
1
1
5
5
3
1
3
5
4
2
...

result:

ok 100002 lines

Test #75:

score: 0
Accepted
time: 459ms
memory: 545636kb

input:

100000
999998388 999992472 999983027 999964773 999963279 999951283 999950880 999934408 999924387 999916418 999904684 999903982 999903323 999902932 999901848 999890455 999861126 999846824 999842850 999832617 999827692 999823954 999823038 999821892 999814773 999791390 999779861 999755956 999748895 999...

output:

2
4
2
4
3
2
5
2
2
2
2
1
4
2
3
3
4
1
2
2
1
2
2
1
3
1
1
3
1
3
3
3
1
3
2
1
2
1
5
2
3
1
2
3
2
2
1
1
3
4
1
1
1
1
2
2
5
1
2
4
2
1
1
5
3
1
2
1
5
2
1
1
4
1
1
2
1
3
3
4
3
5
1
2
1
2
1
1
2
1
1
2
1
2
2
2
1
2
3
2
2
1
4
1
1
1
2
1
2
1
3
4
3
4
1
1
1
3
2
2
2
3
2
2
4
1
1
2
2
3
1
1
1
1
1
4
2
2
3
1
1
3
1
3
5
3
1
1
2
4
...

result:

ok 100002 lines

Test #76:

score: 0
Accepted
time: 363ms
memory: 593060kb

input:

100000
993008519 146022225 604155615 718738203 494270163 652193137 726796672 94792684 820864876 549569362 829507440 678929032 370307391 344030005 159841431 334544886 937946370 808171575 982936137 406172084 606958454 37019021 4928645 19688703 431277735 368642501 122957106 319157770 412765992 11198976...

output:

11803

result:

ok 3 lines

Test #77:

score: 0
Accepted
time: 394ms
memory: 593648kb

input:

100000
40182145 534750963 47219441 875390747 81526264 760417678 338532233 735498264 324045878 867847994 59843568 773887600 159787753 815005992 380202117 994057104 420819027 751621209 431455690 874518582 286468788 746915239 108591545 609413028 129180541 684472848 170951027 628699282 133169234 5876429...

output:

10641

result:

ok 3 lines

Test #78:

score: 0
Accepted
time: 392ms
memory: 593560kb

input:

100000
275422663 623971262 359872300 719293364 255135323 541992266 440822587 869808644 499149139 763707030 354974961 726924800 330201357 680217772 405944508 793791040 210835281 508081687 259941660 743715189 158261318 948118520 78257478 668842593 103644266 931463910 338599866 777663876 422872806 7486...

output:

3918

result:

ok 3 lines

Test #79:

score: 0
Accepted
time: 229ms
memory: 477372kb

input:

100000
999988156 999976131 999968026 999947275 999945597 999933785 999930172 999920289 999917585 999912234 999908854 999897793 999885917 999875073 999869174 999855731 999844433 999811617 999807251 999800921 999792585 999786180 999781483 999760080 999750045 999744093 999742092 999740171 999733488 999...

output:

1

result:

ok 3 lines

Test #80:

score: 0
Accepted
time: 260ms
memory: 480452kb

input:

100000
13698 28310 35130 49038 53306 57086 63036 75561 76672 81572 87405 101823 116392 121336 131981 152687 154046 161564 166916 167077 175074 181353 215368 216356 242236 282273 302168 302245 315363 328425 331460 337542 344358 346156 346268 349988 364543 398098 398173 417443 425254 429806 483805 495...

output:

3

result:

ok 3 lines

Test #81:

score: 0
Accepted
time: 337ms
memory: 593600kb

input:

100000
686070451 896400233 415977400 557145966 569104546 729711476 7517469 585286333 654728559 526059886 664580363 44964974 822423618 924237671 253134105 907248874 842926901 490665647 968126707 843652090 577413524 822838296 701325974 418582281 682668062 910983736 688209040 48680293 467513665 6473215...

output:

33289

result:

ok 3 lines

Test #82:

score: 0
Accepted
time: 352ms
memory: 593656kb

input:

100000
324786527 811070346 27863928 812278519 469886012 725613704 314110706 938011015 447486290 790851139 225255488 588777115 157708439 967669178 122826315 605497395 442130539 901574836 449101384 630033703 363487572 640039974 495641990 646810950 101835263 504819182 341085568 818338550 309812680 8340...

output:

50000

result:

ok 3 lines

Test #83:

score: 0
Accepted
time: 344ms
memory: 593596kb

input:

100000
328751617 872776434 193896091 937579789 403324609 884873962 19096263 546885897 299955068 810378130 266985913 855008900 113957467 674955114 367808805 824606229 36085456 748004114 360544279 875870329 490814410 550516261 480140569 978076458 371373042 557323008 337625884 791543744 389714119 82617...

output:

49998

result:

ok 3 lines

Test #84:

score: 0
Accepted
time: 187ms
memory: 477060kb

input:

100000
999994414 999989068 999983169 999973305 999956998 999952735 999935815 999932727 999921388 999912247 999910668 999892587 999886472 999886197 999877300 999875077 999873271 999862506 999847958 999843765 999831825 999818755 999813197 999811659 999808140 999800414 999789177 999788823 999783126 999...

output:

1

result:

ok 3 lines

Test #85:

score: 0
Accepted
time: 236ms
memory: 551508kb

input:

100000
552 1167 1507 1559 5688 6188 8616 38613 47871 73234 76958 93583 142300 154838 156445 162479 168262 172236 175115 183892 187208 211463 265659 275302 279294 291311 332477 340758 376960 387576 395567 397517 415963 417398 449245 452439 456342 465878 468169 475771 481256 491236 503318 507666 52887...

output:

5

result:

ok 3 lines

Subtask #5:

score: 17
Accepted

Test #86:

score: 17
Accepted
time: 126ms
memory: 142976kb

input:

23881
605288257 422163932 155875880 339929874 76049859 196344969 958160745 767945284 469191956 997116006 387749577 15911341 920437918 367576975 800789357 351557615 283723284 369507452 841548133 643412903 309731505 256549694 370065644 699518122 559017597 347646657 469353381 575240521 501893001 454519...

output:

7197
7063
150
5030
5227
7333
1778
6675
2012
5921
4878
7477
4598
2769
5360
6465
7660
7234
7794
2760
6321
7056
7302
4749
464
2029
5650
1973
6227
4900
4966
4990
3142
785
5818
3005
7705
6967
1940
5880
7201
4752
1278
6554
2951
894
6601
7019
7236
6076
5182
6579
2343
2070
4337
5744
4437
2262
6686
1739
7756...

result:

ok 31567 lines

Test #87:

score: 0
Accepted
time: 565ms
memory: 593248kb

input:

100000
187962236 252322706 659740540 756184857 615615021 870954164 997894181 924184575 178246679 206117936 948374169 611376809 940125697 583402158 621243496 179806768 420420048 261580744 495350370 179501503 624736464 865025098 132756697 396891347 254854635 384499314 232013282 699329403 718265326 972...

output:

21501
24099
33073
16936
24145
8440
674
23350
29618
2899
7659
19499
19027
10215
4083
14518
30601
23009
17970
7096
15472
32634
26673
29553
6232
11457
690
8753
7786
4078
28404
25386
28535
1752
5912
16456
18098
25382
30618
28242
30215
30920
19228
20981
27023
18696
16047
19091
7953
9832
13542
4224
26991
...

result:

ok 100002 lines

Test #88:

score: 0
Accepted
time: 559ms
memory: 593764kb

input:

100000
195876641 146621733 341834495 380796725 369334549 293410542 978028075 874593626 703011075 519634832 164249958 637129162 298077642 409700388 597488029 208278772 746990129 51413696 131278404 949003744 715997226 208017329 494082201 972593011 718736913 14104256 281109734 780778410 380464107 29853...

output:

31327
32678
5845
12353
3257
8926
13111
9562
10067
19324
255
7803
6244
5462
17193
33299
5823
24299
31456
20379
13299
17670
10250
31047
750
28337
5058
5037
31225
2578
18079
32308
15960
21734
23722
17448
3403
22865
12869
22981
12521
27550
32677
8772
16024
27145
32107
20420
31630
25199
583
30494
13145
2...

result:

ok 100002 lines

Test #89:

score: 0
Accepted
time: 564ms
memory: 593304kb

input:

100000
140151127 703171223 64650609 807179656 91579199 616439566 262279532 635385641 182204773 746966272 29134735 694384584 151383885 835424004 374370699 839210095 26199233 802967114 424348660 929961627 334908843 613933030 264472963 967927306 374534013 795616963 181399017 942772713 325557168 6356971...

output:

16852
44989
5073
188
18334
719
37773
31991
27369
49758
2886
37462
2269
14671
36297
47833
45768
45948
44197
36763
13579
37257
34232
22326
19121
4483
3193
9572
44327
43476
37410
4641
9134
21884
17460
39750
31826
13138
6713
29509
28834
48569
47845
14636
42288
209
9318
7431
45730
16465
5906
40699
39638
...

result:

ok 100002 lines

Test #90:

score: 0
Accepted
time: 587ms
memory: 593680kb

input:

100000
229371426 615845385 8395463 725670138 253945139 837481603 267122821 564928938 88384991 615119435 233045729 736737408 9623699 705904592 292693606 920163778 297466268 725313668 361252589 813252985 350864743 741659990 170849476 539562600 432839207 511464025 99353592 875179636 297454089 687124695...

output:

17581
24948
38391
14419
27799
4569
38668
35697
26067
49978
42190
1235
1655
28211
22625
47715
40160
39008
37550
19341
5003
109
10527
40699
48346
4305
5676
8370
23348
27672
31587
48842
49999
46869
20992
43858
6386
35113
50
46394
49096
24013
33036
49696
44127
30556
26524
3723
36254
9349
12089
2510
3087...

result:

ok 100002 lines

Test #91:

score: 0
Accepted
time: 536ms
memory: 593660kb

input:

100000
487111066 855860485 99041551 892763368 90402565 506637676 222215611 835773505 321823015 869201207 89953137 536799062 104579533 834586895 472040129 763002761 152483347 634595719 449887741 956583186 34700464 521025155 55345113 944384213 127641496 513194723 356649230 967880428 337980827 91463839...

output:

942
45725
29253
32000
34983
3056
10934
34915
6732
11677
1908
652
47087
1198
27913
18121
7533
3821
24817
31833
5715
2456
36255
41755
48827
46825
46456
9695
562
7920
24435
19004
5205
24363
3456
48946
23953
49466
31719
39841
12272
16871
42212
19612
38959
9101
5563
12587
43949
48475
41360
6428
41967
184...

result:

ok 100002 lines

Test #92:

score: 0
Accepted
time: 536ms
memory: 593580kb

input:

100000
27073748 576331364 400237255 795460519 71014022 637435072 214575137 823870913 216504420 807569134 433278403 608674530 363485760 723516242 157786468 990284424 191375275 730792204 290439949 971661182 370244883 986406055 345467763 738556373 233197961 953353962 129769517 642436238 381534949 97463...

output:

15228
45987
5889
540
24979
14594
39331
30269
9981
22404
3267
11420
12707
42431
49834
35779
22037
20640
28981
41713
13306
2152
44699
25014
49999
49722
28703
25852
31644
27995
42377
43981
46325
34863
25315
25298
48064
12187
614
35850
45155
47254
21988
7289
5643
47552
48834
14785
10748
44858
26283
2402...

result:

ok 100002 lines

Test #93:

score: 0
Accepted
time: 365ms
memory: 477104kb

input:

100000
14044 31568 48921 51214 59358 71379 100023 115598 139483 155653 157116 163984 169449 181325 188904 191112 194401 200495 208085 244825 258317 269389 271415 278442 294904 302861 331145 358689 365346 371514 371674 420312 426358 426926 439486 447109 449034 452747 459208 464379 471543 477242 48520...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #94:

score: 0
Accepted
time: 366ms
memory: 477108kb

input:

100000
999997134 999971880 999971447 999963682 999958496 999954233 999941005 999934956 999913043 999912124 999899751 999895915 999889723 999865869 999850495 999849430 999843930 999825051 999812617 999790616 999785641 999771255 999768902 999766470 999753769 999744896 999726315 999707943 999707638 999...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #95:

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

input:

100000
10308 12726 14970 29067 32105 43123 49977 68697 88015 88028 126474 130169 135685 137521 160062 169353 177310 194965 211656 230278 234919 235394 248590 252495 255260 261674 277375 302750 310249 323236 330372 331411 353695 359830 374529 382948 412643 433170 449860 454473 473256 476229 477424 48...

output:

5
3
5
5
1
5
1
2
1
3
3
5
3
5
5
5
5
2
3
5
5
1
5
1
1
2
3
5
5
2
2
5
5
1
1
4
1
1
1
5
5
1
1
1
1
5
5
3
5
5
1
1
3
5
3
5
5
3
4
4
5
1
2
3
1
4
5
3
5
3
5
5
1
4
2
3
5
5
1
3
1
3
5
5
4
1
5
2
5
1
1
3
5
5
1
3
1
5
5
5
5
3
5
1
5
2
1
4
5
4
1
5
4
1
5
3
2
5
1
5
2
5
5
2
5
1
2
5
1
3
5
2
3
1
4
1
3
5
4
4
1
2
5
3
5
3
2
5
1
1
...

result:

ok 100002 lines

Test #96:

score: 0
Accepted
time: 388ms
memory: 576968kb

input:

100000
999999375 999993451 999991946 999986204 999984712 999978443 999965310 999963490 999950472 999950215 999935622 999934052 999920801 999884366 999878792 999871703 999841904 999839499 999835391 999831297 999828717 999815901 999773795 999769518 999747787 999736911 999729803 999726952 999716990 999...

output:

3
1
3
5
3
3
1
4
5
3
3
3
3
1
3
3
3
3
1
4
1
1
3
3
1
2
4
1
3
3
1
3
3
2
4
3
1
3
3
2
2
3
3
3
3
1
5
3
3
5
1
3
1
3
3
3
4
3
3
5
3
3
4
3
1
3
3
3
5
3
3
5
5
3
5
3
2
3
5
3
5
5
3
4
3
3
5
3
3
3
3
3
5
3
1
3
3
1
3
3
3
3
3
5
3
4
3
4
3
1
3
1
3
5
3
5
3
3
1
3
2
3
3
5
3
3
4
4
3
3
3
3
5
3
4
3
1
3
1
3
3
1
1
3
5
3
3
3
3
3
...

result:

ok 100002 lines

Subtask #6:

score: 19
Accepted

Test #97:

score: 19
Accepted
time: 619ms
memory: 526592kb

input:

88768
238644804 620122421 789364401 899010695 885388612 437964772 845379533 657562749 773925456 625793781 916240972 291506550 379611161 905077982 629848170 530056471 520438258 806293637 326792996 785404568 74285074 565304193 846963319 63529729 804909008 212070492 69936548 656129389 408708069 3070450...

output:

7293
18702
4922
19044
23488
1992
20887
9156
21248
15708
115
11736
8529
19157
9407
9139
5401
20114
1699
3993
22639
5925
17883
12913
5726
12378
21617
15763
646
5418
16982
7639
6140
1776
6289
619
766
3079
8806
11541
7217
2650
15835
2238
2024
9705
23983
4664
8898
5006
2392
20170
8341
14535
16454
6623
18...

result:

ok 85825 lines

Test #98:

score: 0
Accepted
time: 755ms
memory: 594672kb

input:

100000
821318783 448021739 293229061 462749326 277470126 112573967 30337160 961285688 337755987 539828416 181898269 886972019 692006779 120903166 745269606 63338329 802359215 553142737 128078880 176268977 801614897 319003788 904621668 760902954 355521853 953955853 272787937 630475166 479856202 97240...

output:

4072
1852
14754
15134
16937
1671
2095
6403
19494
11439
5340
5911
14816
2035
1864
3849
1585
261
991
13796
13299
5424
2956
10339
14124
311
5887
12171
7462
7227
17292
10436
12595
20040
14674
5120
2783
3869
10726
119
8309
10154
2397
21296
9862
1583
16958
669
12228
2332
1606
1416
6889
3081
4920
5185
3298...

result:

ok 100002 lines

Test #99:

score: 0
Accepted
time: 730ms
memory: 593496kb

input:

100000
974457380 489804414 975323016 792393898 178673302 829997641 715503758 764211091 7744575 148312608 397774058 912724371 757250885 947201396 721514139 91810332 983705104 488199881 616523266 90995409 40359308 661996020 970979876 41637322 819404132 26011739 881692902 6891469 437022280 151058744 75...

output:

12840
8299
4235
10320
5766
7536
5596
3148
4241
4794
9978
1895
179
451
7353
1793
10382
3741
5016
8835
6606
4163
6024
1130
11787
172
7926
3939
12012
5121
9723
5717
3639
1405
7171
3784
3569
3033
5060
3121
2791
748
2868
3357
3420
3811
629
175
2172
729
352
4670
468
3707
6598
1566
2816
8561
8123
9970
2859...

result:

ok 100002 lines

Test #100:

score: 0
Accepted
time: 747ms
memory: 594404kb

input:

100000
357347743 761725897 425912256 926238155 365934964 834336116 263223794 788454869 27764697 694141901 151041985 988404305 258981391 772070971 449750311 968490622 42354191 702772109 162405523 848221756 280890184 509945710 297977771 543291234 151532412 727310095 275706410 646634937 86407089 699514...

output:

16338
14679
4268
2726
15988
8214
27571
22198
15685
19570
17801
5128
21721
22935
13365
18140
13063
9951
6043
15247
3286
2717
27739
21451
1457
15909
1135
9419
14494
25887
14324
12952
968
10801
3561
6807
655
9306
5633
9975
8663
22489
2542
1301
11781
3154
9214
8306
6573
14500
12338
2643
20065
3220
9671
...

result:

ok 100002 lines

Test #101:

score: 0
Accepted
time: 731ms
memory: 593840kb

input:

100000
446568041 977107032 25904 776140085 397534174 533766150 347710597 844334914 164510494 896515795 378013522 673766086 499181052 613613383 342801166 733889534 176721824 762866517 158619611 819383953 393003811 522697473 472793464 619440492 466162100 888565185 283086307 994250345 412123886 9892218...

output:

1377
878
2185
2761
2530
139
297
1475
2650
1341
2727
35
346
530
2796
412
2711
1901
737
1438
420
1432
797
1058
2365
2294
211
460
337
741
1388
638
2418
698
2642
936
953
289
330
844
898
371
1263
1934
1328
79
2233
1
513
1983
341
1252
907
453
2243
2181
216
55
1205
38
1014
923
230
1029
3099
1704
1751
1976
...

result:

ok 100002 lines

Test #102:

score: 0
Accepted
time: 727ms
memory: 593484kb

input:

100000
361993958 518400744 170314362 832430504 67737131 850498699 143438389 769073065 427026389 626235093 12315845 999053531 232178431 595719744 222091361 748826451 155745346 808153197 423388481 812451436 308312330 566155367 122907128 549657129 119893951 984086377 228383550 902865377 3355028 8485702...

output:

18034
20102
1895
16533
681
8957
14295
4993
10079
282
10937
1010
482
27975
102
10644
6387
18707
16968
9529
11818
17621
8331
15637
20436
9145
13267
22435
5805
7604
5138
15321
3858
3773
11244
6753
13271
10798
6810
16433
6838
17572
9970
3550
4102
16058
16542
2808
19134
14852
2970
3443
2201
7133
13333
22...

result:

ok 100002 lines

Test #103:

score: 0
Accepted
time: 662ms
memory: 593564kb

input:

100000
460137395 804405301 58412926 580805892 202047511 526162554 13011089 597669368 448283525 678943914 448778424 855654466 224926600 593802085 452052881 931504627 479165179 541410305 432698072 837263488 156840126 922641654 362658558 566709443 354409794 860635108 343400593 547170419 47960825 794404...

output:

14195
798
14769
40813
21362
6631
27858
25515
13353
8303
3983
10784
7082
694
33161
4293
622
6659
15577
41902
24382
3694
11428
3894
7049
16527
17511
33512
19159
22408
12885
37346
528
9497
3758
14247
12071
9278
19894
17240
14140
20935
12348
32985
23893
18824
17970
18193
21237
42784
4977
28342
16114
436...

result:

ok 100002 lines

Test #104:

score: 0
Accepted
time: 381ms
memory: 477088kb

input:

100000
9029 13328 60594 74789 92931 98307 99287 122661 132414 144464 153362 156308 173886 186071 191902 207160 207573 213309 219779 224219 227911 247218 249622 256078 261818 277448 283109 289909 304555 308246 317764 330995 332460 332847 338963 372499 380206 381667 401309 404116 422509 426670 427254 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #105:

score: 0
Accepted
time: 405ms
memory: 477368kb

input:

100000
999999583 999996444 999990759 999981900 999977063 999975945 999973268 999961236 999939255 999926088 999923000 999919471 999916077 999908044 999901288 999892936 999885820 999865023 999851052 999841115 999832096 999789782 999786011 999779898 999776310 999774662 999765940 999764443 999758749 999...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #106:

score: 0
Accepted
time: 406ms
memory: 576292kb

input:

100000
15180 55649 59204 59918 64994 66814 99453 103738 108400 125117 130280 152398 157206 223821 239854 249563 259321 274250 280754 290313 325986 339391 366946 373870 378408 396962 415846 418253 422799 424902 437012 441682 453633 454154 455709 458338 458431 461956 465675 474344 521281 537278 542801...

output:

1
1
1
2
2
2
1
2
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
2
1
1
1
1
1
2
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
2
1
1
2
3
1
1
1
1
1
2
1
2
2
1
1
2
2
2
3
1
2
1
1
1
2
1
2
1
1
1
1
1
1
1
1
2
1
2
1
2
1
1
1
2
1
1
1
2
2
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #107:

score: 0
Accepted
time: 478ms
memory: 539396kb

input:

100000
999994820 999987011 999986026 999980658 999961434 999934009 999928563 999924366 999917988 999913748 999881985 999880095 999876426 999875518 999865029 999860940 999854674 999850058 999846978 999832772 999827807 999825927 999822632 999821616 999803277 999752668 999748175 999745486 999744103 999...

output:

2
2
2
1
2
2
2
1
2
1
2
1
1
1
2
1
1
2
1
2
1
2
1
1
1
2
2
1
1
3
1
2
2
1
1
2
1
1
2
2
1
1
1
2
1
2
1
1
2
2
1
2
1
2
2
2
2
1
2
2
2
1
1
2
1
2
2
2
1
1
1
1
2
1
2
2
2
1
1
2
2
2
1
1
2
2
2
2
2
1
2
1
1
1
2
2
1
2
2
1
1
2
2
1
1
1
2
2
2
1
2
1
1
2
1
1
1
2
2
2
2
1
2
2
1
1
2
2
1
1
1
1
1
1
1
2
2
1
1
2
2
1
1
1
1
2
2
1
1
1
...

result:

ok 100002 lines

Subtask #7:

score: 23
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #108:

score: 23
Accepted
time: 466ms
memory: 207528kb

input:

34697
450371872 835005726 736172308 12036322 366524055 250263025 344438336 289697236 47583765 6096557 876172841 499145130 719945055 953100948 559938124 603298948 261505595 109809588 295663178 203875443 678356657 794213682 902707235 590733244 620746061 106652035 113767547 946929941 848185178 34820369...

output:

2227
128
173
26
2473
380
89
6788
165
425
285
191
990
342
4280
4333
5513
875
4296
1170
4970
187
7128
1072
52
12
1477
666
147
2772
1229
96
711
4135
245
1623
594
14
1428
1255
3422
981
1672
4825
278
4646
2832
3242
10
272
1663
290
23
2188
322
690
6517
7317
3159
259
1855
2583
3154
4972
254
4078
994
129
60...

result:

ok 68646 lines

Test #109:

score: 0
Accepted
time: 951ms
memory: 593056kb

input:

100000
106498905 200542990 207087768 378249177 565846243 37010239 82449689 981761353 108586737 467375585 136926386 182473752 179433612 808851988 492308370 626078613 887685717 504884514 776136478 13234132 212093895 255213502 100981558 188096247 161939063 428606279 160194421 991447146 877269845 188162...

output:

3085
4594
1884
8616
24531
20
455
9990
5213
8681
4000
1293
6819
257
918
147
2214
1813
5976
1831
7263
4769
6090
1935
1827
7311
1568
9705
3403
7556
2560
5985
96
11228
5262
2683
2329
4201
3080
986
34
3711
526
10538
341
7934
3651
5566
201
214
6248
1439
21329
955
6420
7913
293
766
191
4071
9064
2090
1628
...

result:

ok 100002 lines

Test #110:

score: 0
Accepted
time: 933ms
memory: 593584kb

input:

100000
966929662 242325664 889181723 707893750 321825226 754433913 917359390 932170404 926058973 780892481 647769471 768034617 537385558 75341707 468552903 799774808 774064310 734908954 412064512 632993269 450838305 598205734 462307063 763797912 625821342 58211221 766839929 367863449 394244434 36907...

output:

21008
4651
10362
1482
2681
4872
6586
617
5511
6392
5492
1680
616
7408
1594
5254
3898
82
21480
2517
5547
5422
18943
12596
1990
84
5980
9861
637
3881
597
5638
3192
2446
762
1177
7190
2508
116
12475
5339
9464
2939
44
12694
12803
2447
35
5926
2902
676
1551
4168
2122
17084
20736
3519
16339
160
644
6222
1...

result:

ok 100002 lines

Test #111:

score: 0
Accepted
time: 946ms
memory: 593824kb

input:

100000
135501965 554060445 285631779 625707624 261661881 505646241 75361658 794289703 17788607 576218091 373860959 788000132 85015404 879768378 348117031 876001105 332171042 577622804 151782753 604934047 350032215 523953105 338048292 624781970 377945844 685179681 177996142 945003410 420279575 985288...

output:

1342
4505
2684
10274
9616
5280
5591
7549
27746
310
5280
1798
11634
1327
9851
1901
2449
22487
5899
31209
6888
8496
2320
5267
11124
4201
8493
541
1217
4404
5548
7663
1490
8972
9656
3678
93
254
5432
9097
6636
1335
1455
7929
25561
27025
251
7244
4010
5130
34527
21947
24004
1549
12288
8182
11632
1233
942...

result:

ok 100002 lines

Test #112:

score: 0
Accepted
time: 911ms
memory: 593324kb

input:

100000
224722264 834567100 43236468 618680347 209672038 609101477 73903821 818483752 446812567 785986906 93947915 978971759 189517862 521157918 142976633 824127749 424987205 558618032 50041153 635647656 369262277 958413736 186768405 733130930 320235923 530718247 225522941 862969707 449605806 6717043...

output:

26751
7227
4955
14383
11037
14126
2488
209
14867
2676
26171
820
610
6542
22580
11611
15110
658
4652
13426
15008
2792
134
3828
1367
13115
15031
167
5132
11731
40271
11235
8903
4742
533
382
5138
6494
1171
16180
6309
3382
53
2775
5402
2149
220
2596
701
1908
4696
9713
4877
20287
3586
5381
2995
1315
1377...

result:

ok 100002 lines

Test #113:

score: 0
Accepted
time: 948ms
memory: 594824kb

input:

100000
149071319 771073982 366937673 527487119 29618099 750315895 366257363 953967837 114599161 583534331 476061533 961345432 185210719 786321915 451948777 580579345 205080393 560330791 45252044 596075484 31171706 862224816 129540529 989603499 410419111 943053107 98922636 951249310 44753823 98181841...

output:

27370
33557
1730
931
2706
23639
1938
289
2482
2267
422
12644
1755
28500
2116
1017
1314
36783
40689
13467
1091
4657
34712
3336
2252
1305
8265
5649
14578
6437
5811
4135
3326
1372
8495
1333
33012
4093
9857
5096
26033
9486
1224
16
2743
25673
14140
3286
2667
36
8064
10035
6954
5952
3906
96
1989
4598
807
...

result:

ok 100002 lines

Test #114:

score: 0
Accepted
time: 899ms
memory: 593368kb

input:

100000
238291617 770648801 163928479 552648570 275862506 539321360 306530585 708848293 483784243 705261132 223589463 653152059 263239690 800729240 239321265 822497270 66658802 709854728 70915610 533020423 244202412 689058866 230269805 522020406 109215878 895021084 52987284 809121960 13330995 6331591...

output:

11824
10395
4543
11236
25317
393
104
3107
1098
3579
4601
590
119
10169
5282
18851
768
173
9312
4549
10330
910
5268
4421
1350
27385
8108
14145
25295
17250
2100
11812
13397
8529
387
87
7134
13842
3825
20354
632
3020
3188
1889
12422
14773
4722
2346
6503
13745
4607
3102
5989
19606
6808
3312
6135
3649
43...

result:

ok 100002 lines

Test #115:

score: 0
Accepted
time: 474ms
memory: 476952kb

input:

100000
426 8170 8621 15302 16503 50033 50538 51792 60795 73412 101503 106259 112826 124498 124681 142848 156934 179041 183467 190125 201698 201793 215213 221400 222029 224186 226869 237203 238086 247320 249844 268036 268861 271648 300407 301673 317419 331637 332503 337409 345414 360656 363446 382505...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #116:

score: 0
Accepted
time: 490ms
memory: 476996kb

input:

100000
999997087 999991326 999980174 999978063 999977884 999958380 999940740 999899065 999897429 999892504 999891099 999878289 999831620 999828014 999824896 999812859 999806292 999803464 999799269 999788831 999764822 999741878 999731308 999723577 999720367 999697123 999688388 999686501 999686199 999...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #117:

score: 0
Accepted
time: 506ms
memory: 586388kb

input:

100000
9418 31448 39290 40078 42143 49362 52722 55453 62409 63234 70651 81763 82773 83237 92126 100933 108631 113814 116669 119057 119562 130226 147030 151837 182347 183131 194038 206859 213072 238972 241477 267681 272595 285696 320327 320619 330445 356307 356764 360923 364321 365862 382934 395089 4...

output:

1
1
1
2
1
1
1
1
1
2
1
1
3
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
1
2
1
1
1
2
2
1
3
1
2
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
2
1
1
1
1
2
2
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
3
1
1
2
1
1
3
2
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
...

result:

ok 100002 lines

Test #118:

score: 0
Accepted
time: 485ms
memory: 546760kb

input:

100000
999990962 999985351 999977999 999977140 999952132 999949712 999947017 999935526 999927546 999916788 999900394 999885569 999879728 999865065 999855283 999843044 999821335 999814824 999799709 999799365 999791720 999790682 999786323 999782629 999777700 999766715 999762052 999755399 999754272 999...

output:

1
1
2
1
2
1
1
1
1
1
1
1
1
1
3
1
1
1
2
1
1
1
1
2
2
1
1
1
2
1
1
1
1
2
1
1
1
1
2
1
1
2
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
3
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
...

result:

ok 100002 lines

Test #119:

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

input:

7
10 20 60 40 50 30 70
1 5 10
-2 -2 -2
2 2 100
0 6 17
-2 -2 -2
-1 -1 -1

output:

3
1
2

result:

ok 5 lines