QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508387#9159. 登山Galex40 1407ms66676kbC++145.7kb2024-08-07 14:28:532024-08-07 14:28:53

Judging History

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

  • [2024-08-07 14:28:53]
  • 评测
  • 测评结果:40
  • 用时:1407ms
  • 内存:66676kb
  • [2024-08-07 14:28:53]
  • 提交

answer

#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define pii pair<int, int>
#define fi first
#define se second
#define mkp make_pair
using namespace std;

LL read() {
	LL s = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9')
		f = (ch == '-' ? -1 : 1), ch = getchar();
	while (ch >= '0' && ch <= '9')
		s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
	return s * f;
}

const int MAXN = 1e5 + 5, mod = 998244353;

auto fplus = [](int x, int y) {return x + y < mod ? x + y : x + y - mod;};
auto fminus = [](int x, int y) {return x >= y ? x - y : x + mod - y;};
auto Fplus = [](int &x, int y) {x = fplus(x, y);};
auto Fminus = [](int &x, int y) {x = fminus(x, y);};

int n;
vector<int> e[MAXN];
int fa[MAXN], dep[MAXN];
int l[MAXN], r[MAXN], h[MAXN], dp[MAXN];

int sz[MAXN], son[MAXN];
int dfn[MAXN], rnk[MAXN], tim = 0, top[MAXN];
int mn[MAXN][20], Fa[MAXN][20], nxt[MAXN], mn2[MAXN][20];

void dfs(int x) {
	sz[x] = 1, son[x] = 0;
	for (int y : e[x]) {
		dfs(y), sz[x] += sz[y];
		if (sz[y] > sz[son[x]])
			son[x] = y;
	}
}

void cut(int x, int tp) {
	top[x] = tp, dfn[x] = ++tim, rnk[tim] = x;
	if (son[x])
		cut(son[x], tp);
	for (int y : e[x])
		if (y != son[x])
			cut(y, y);
}

int get(int x, int v) {//x 的祖先中最深的 p 满足 h[p] <= v
	for (int i = 17; i >= 0; i--)
		if (mn[x][i] > v)
			x = Fa[x][i];
	return x;
}

int get2(int x, int v) {//x 的祖先中最深的 p 满足 h[nxt[p]] < v
	for (int i = 17; i >= 0; i--)
		if (mn2[x][i] >= v)
			x = Fa[x][i];
	return x;
}

int jump(int x, int d) {
	for (int i = 17; i >= 0; i--)
		if ((1 << i) <= d)
			d -= (1 << i), x = Fa[x][i];
	return x;
}

int d[MAXN];
vector<pii> md[MAXN];

void modify(int l, int r, int v, int tp) {
	// cout << l << ' ' << r << ' ' << v << ' ' << tp << endl;
	md[l].push_back(mkp(v, tp));
	md[r + 1].push_back(mkp(v, mod - tp));
}

void mdf(int u, int l, int v, int tp) {//u到 l(不含l)	
	if (!v)
		return ;
	// cout << u << ' ' << l << ' ' << v << ' ' << tp << endl;
	while (top[u] != top[l])
		modify(dfn[top[u]], dfn[u], v, tp), u = fa[top[u]];
	if (u != l)
		modify(dfn[l] + 1, dfn[u], v, tp);
}

int f[MAXN];

namespace SGT {

#define ls (p << 1)
#define rs (p << 1 | 1)
#define mid ((l + r) >> 1)

int base[MAXN << 2], sum[MAXN << 2], tag[MAXN << 2];

void maintain(int p) {
	sum[p] = fplus(sum[ls], sum[rs]);
	base[p] = fplus(base[ls], base[rs]);
}

void build(int l, int r, int p) {
	base[p] = sum[p] = tag[p] = 0;
	if (l == r) return ;
	build(l, mid, ls), build(mid + 1, r, rs);
}

void pushtag(int p, int v) {
	Fplus(sum[p], 1ll * base[p] * v % mod), Fplus(tag[p], v);
}

void pushdown(int p) {
	pushtag(ls, tag[p]), pushtag(rs, tag[p]), tag[p] = 0;
}

void mdf(int l, int r, int p, int x, int y, int v) {
	if (r < x || y < l)
		return ;
	if (x <= l && r <= y) {
		pushtag(p, v);
		return ;
	}
	pushdown(p);
	mdf(l, mid, ls, x, y, v), mdf(mid + 1, r, rs, x, y, v);
	maintain(p);
}

void modify(int l, int r, int p, int x, int v) {
	if (l == r) {
		base[p] = v, sum[p] = 1ll * base[p] * tag[p] % mod;
		return ;
	}
	pushdown(p);
	x <= mid ? modify(l, mid, ls, x, v) : modify(mid + 1, r, rs, x, v);
	maintain(p);
}

}

void mdf(int u, int v) {
	// cout << u << ' ' << v << endl;
	while (u)
		SGT::mdf(1, n, 1, dfn[top[u]], dfn[u], v), u = fa[top[u]];
}

void work() {
	n = read();
	for (int i = 1; i <= n; i++)
		e[i].clear(), md[i].clear();
	for (int i = 2; i <= n; i++) {
		fa[i] = read(), l[i] = read(), r[i] = read(), h[i] = read();
		e[fa[i]].push_back(i), dep[i] = dep[fa[i]] + 1;
		l[i] = dep[i] - l[i], r[i] = dep[i] - r[i], swap(l[i], r[i]);
	}
	for (int i = 1; i <= n; i++)
		h[i] = dep[i] - h[i] - 1;//, cout << h[i] << ' ';
	// cout << endl;
	// for (int i = 2; i <= n; i++)
	// 	cout << l[i] << ' ' << r[i] << endl;
	// cout << endl;
	tim = 0, dfs(1), cut(1, 1);
	for (int i = 2; i <= n; i++)
		mn[i][0] = h[i], Fa[i][0] = fa[i];
	for (int j = 1; j <= 18; j++)
		for (int i = 1; i <= n; i++)
			Fa[i][j] = Fa[Fa[i][j - 1]][j - 1], mn[i][j] = min(mn[i][j - 1], mn[Fa[i][j - 1]][j - 1]);
	for (int i = 2; i <= n; i++)
		nxt[i] = get(fa[i], h[i]), mn2[i][0] = h[nxt[i]];
	for (int j = 1; j <= 18; j++)
		for (int i = 1; i <= n; i++)
			mn2[i][j] = min(mn2[i][j - 1], mn2[Fa[i][j - 1]][j - 1]);
	// cout << endl;
	memset(d, 0, sizeof d);
	for (int i = 2; i <= n; i++) {
		// cout << i << ":\n";
		int p = get(i, r[i]), L = jump(i, dep[i] - l[i]), R = jump(i, dep[i] - r[i]);
		if (h[p] < l[i]) {
			if (l[i] <= dep[p])
				mdf(i, p, R, 1), mdf(i, p, fa[L], -1);
			else
				mdf(i, L, R, 1), mdf(i, L, fa[L], -1);
			continue;
		}
		mdf(i, p, R, 1), d[p]++;
		// cout << p << ' ';
		p = get2(p, l[i]), d[p]--;
		// cout << p << ' ' << nxt[p] << ' ' << L << endl;
		if (l[i] <= dep[nxt[p]])
			mdf(p, nxt[p], jump(p, dep[p] - h[p]), 1), mdf(i, nxt[p], fa[L], mod - 1);
		else
			mdf(p, L, jump(p, dep[p] - h[p]), 1), mdf(i, L, fa[L], mod - 1);
	}
	// cout << endl;
	for (int i = n; i > 1; i--)
		if (d[i])
			mdf(i, nxt[i], jump(i, dep[i] - h[i]), d[i]), d[nxt[i]] += d[i];
	// cout << endl;
	SGT::build(1, n, 1);
	for (int i = 1; i <= n; i++) {
		for (pii x : md[i])
			mdf(x.fi, x.se);
		if (i == 1)
			f[i] = 1;
		else
			f[i] = SGT::sum[1];
		// cout << "Q" << ' ' << i << ' ' << f[i] << endl;
		SGT::modify(1, n, 1, i, f[i]);
	}
	for (int i = 2; i <= n; i++)
		printf("%d%c", f[dfn[i]], " \n"[i == n]);
}

signed main() {
	// freopen("ex_4.in", "r", stdin);
	// freopen("1.out", "w", stdout);
	read(); int t = read();
	while (t--)
		work();
	cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

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

input:

1
4
6
1 1 1 0
1 1 1 0
3 1 2 1
3 2 2 0
4 2 3 1
6
1 1 1 0
2 1 2 0
2 1 2 0
1 1 1 0
4 1 2 2
6
1 1 1 0
1 1 1 0
3 1 2 1
4 2 2 0
3 1 1 0
6
1 1 1 0
1 1 1 0
3 1 1 0
4 2 3 1
2 1 2 0

output:

1 4 2 1 5
3 4 4 1 0
1 2 1 2 2
2 2 5 3 3

result:

ok 20 numbers

Pretest #2:

score: 5
Accepted
time: 2ms
memory: 22024kb

input:

2
4
300
1 1 1 0
2 1 2 1
3 1 3 1
1 1 1 0
3 1 3 0
4 2 2 3
7 1 2 0
8 2 2 2
7 1 3 4
7 3 4 4
11 1 6 1
12 1 3 5
10 2 5 5
13 1 5 4
13 4 7 2
15 8 8 8
16 8 9 4
15 1 9 6
18 4 5 6
19 3 8 8
18 5 10 2
19 3 7 5
23 5 7 6
22 6 8 10
23 4 7 3
24 1 4 6
24 8 12 9
28 7 11 8
26 1 9 7
28 1 3 1
29 2 5 0
32 1 6 4
30 5 12 7
...

output:

19 18 35 1 38 15 50 0 0 15 349 261 0 525 195 0 108 490 0 0 103 632 393 0 814 0 378 625 174 1025 6236 3125 139 2003 1218 1935 37 265 1218 3929 19 0 211 0 19 1135 35695 14466 46868 29814 18352 5053 11375 28739 0 27114 13392 7593 423 2714 22394 22394 15506 1218 8147 13088 0 17493 42846 178996 171635 9 ...

result:

ok 1196 numbers

Pretest #3:

score: 5
Accepted
time: 5ms
memory: 26320kb

input:

3
4
300
1 1 1 0
2 1 2 1
3 3 3 0
2 1 2 1
3 1 3 1
3 1 3 0
4 1 4 1
6 4 4 2
9 3 5 1
7 3 4 2
10 2 5 4
12 1 5 2
11 1 3 2
12 3 6 6
13 6 6 3
13 3 8 0
14 3 5 0
16 3 5 5
16 6 9 5
20 2 7 3
20 3 7 9
21 7 9 2
23 3 4 8
21 4 9 6
24 11 12 2
25 3 4 1
27 7 13 5
26 1 8 3
29 2 4 6
29 6 15 14
29 5 5 10
32 6 10 11
30 1 9...

output:

20 18 40 1 233 80 39 212 229 41 190 5094 56 0 4147 713 118 0 4129 5124 0 3313 2850 947 21534 9179 903 21496 2811 1 0 0 2811 143571 56660 67998 10105 25021 67687 3214 0 0 82668 44365 27652 38 25699 379349 23912 1787 84893 13400 25076 13513 0 3370 24657 0 24275 58446 49516 740 0 1198 48652 0 942 256 1...

result:

ok 1196 numbers

Pretest #4:

score: 0
Wrong Answer
time: 36ms
memory: 24152kb

input:

4
4
5000
1 1 1 0
1 1 1 0
1 1 1 0
4 1 2 0
5 2 3 2
5 1 3 1
6 2 3 2
6 2 3 1
8 3 5 4
8 4 5 3
11 2 4 4
11 1 3 3
11 5 6 3
12 1 1 6
15 1 5 3
15 1 6 6
17 5 6 5
17 6 8 4
18 7 9 3
19 1 10 3
19 2 4 7
20 1 9 3
23 8 11 7
22 2 5 4
23 7 8 1
24 1 9 8
26 9 11 7
28 8 10 13
29 1 11 3
30 9 9 14
31 11 15 4
32 8 16 8
31 ...

output:

-184550937 -184550937 28 83 25 -184550909 108 -184550827 -184550937 79 21 -184550938 -184550909 21 -184550805 133 533 -184550557 1227 -184550593 -184550938 1112 -184550586 -184550917 423 -184550830 236 20 3618 384 -184548054 -184548370 2114 -184550938 -184543613 1427 -184543613 -184547407 1211 1211 ...

result:

wrong answer 1st numbers differ - expected: '1', found: '-184550937'

Pretest #5:

score: 0
Wrong Answer
time: 35ms
memory: 24212kb

input:

5
4
5000
1 1 1 0
1 1 1 0
1 1 1 0
2 1 2 0
3 1 1 1
4 1 1 0
6 1 3 2
7 1 3 1
8 2 2 0
8 1 3 2
11 3 5 1
10 1 5 4
13 1 2 4
12 3 4 3
15 3 5 2
15 2 6 2
15 1 3 3
16 7 7 3
19 1 7 4
18 2 3 4
20 1 10 5
21 2 3 8
21 4 9 6
22 7 9 3
24 2 6 8
25 1 3 4
25 3 4 1
26 3 4 3
29 5 11 9
28 8 11 12
29 7 9 11
32 5 12 5
32 11 1...

output:

2 35 2 3 34 5 34 3 35 277 514 1 0 444 1451 380 134 1106 1071 134 726 0 134 345 64 0 2177 232 69 0 29 1472 1695 0 1625 0 0 1589 0 4219 2460 104 68 725 1235 1337 15332 1171 0 16744 9322 1360 13966 22157 3645 2319 16617 4491 15278 7736 1339 7806 9758 10865 1339 28395 22817 4866 1338 36 4422 64 5226 325...

result:

wrong answer 1885th numbers differ - expected: '808380159', found: '-189864194'

Pretest #6:

score: 5
Accepted
time: 1005ms
memory: 62260kb

input:

6
4
100000
1 1 1 0
2 1 1 0
3 1 1 0
4 2 2 0
5 1 1 0
6 2 2 0
7 6 6 0
8 3 3 0
9 6 6 0
10 8 8 0
11 6 6 0
12 12 12 0
13 11 11 0
14 2 2 0
15 2 2 0
16 2 2 0
17 9 9 0
18 1 1 0
19 4 4 0
20 18 18 0
21 13 13 0
22 20 20 0
23 3 3 0
24 21 21 0
25 8 8 0
26 11 11 0
27 11 11 0
28 3 3 0
29 21 21 0
30 1 1 0
31 27 27 0...

output:

7 90 1343 13340 200010 2186770 17480820 279693113 800242414 420706509 214087588 358274752 946289212 530647994 955227776 663050301 438245147 621009062 780623708 80919478 728275212 743623748 978006196 735181462 256088384 612217572 335562169 696082683 110948988 53450390 637356472 107616671 988788196 54...

result:

ok 399996 numbers

Pretest #7:

score: 5
Accepted
time: 1286ms
memory: 66076kb

input:

7
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
3 1 1 0
1 1 1 0
3 1 1 0
7 1 1 0
6 1 1 0
9 2 2 0
6 1 1 0
6 1 1 0
7 2 2 0
9 2 2 0
11 1 1 0
11 2 2 0
14 4 4 0
12 1 1 0
16 3 3 0
15 1 1 0
17 3 3 0
20 5 5 0
18 4 4 0
20 2 2 0
19 2 2 0
22 5 5 0
22 2 2 0
22 3 3 0
23 5 5 0
27 7 7 0
26 6 6 0
27 5 5 0
31 1 1 0
33 9 9 0
34 2 ...

output:

1 1 1 1 31 2 2 94 31 1298 33 1 126 41443 62 95 35 93 1490650 94 49108564 2 41443 62 31502098 1491949 41443 1 1 882058713 1298 808538694 650336433 808538694 808538695 53283330 1298 31502098 1 31502098 319947267 692436002 360370658 1534689 1298 41443 692394559 41443 518136386 1298 972986764 32 6923530...

result:

ok 399996 numbers

Pretest #8:

score: 0
Wrong Answer
time: 749ms
memory: 60860kb

input:

8
4
100000
1 1 1 0
2 2 2 0
3 3 3 0
4 4 4 2
5 2 2 1
6 6 6 0
7 2 2 0
8 7 7 3
9 4 4 3
10 1 1 4
11 3 3 0
12 8 8 11
13 13 13 7
14 5 5 10
15 8 8 11
16 14 14 5
17 9 9 2
18 17 17 7
19 3 3 1
20 1 1 9
21 14 14 5
22 5 5 17
23 8 8 14
24 8 8 9
25 24 24 7
26 24 24 7
27 17 17 8
28 27 27 27
29 26 26 6
30 17 17 14
3...

output:

12 23 22 21 42 62 61 19 49 7 26 7 77 76 76 156 133 114 258 102 102 41 41 48 48 36 13 6 140 118 41 203 155 155 41 61 61 61 328 279 279 123 111 111 111 225 204 90 109 252 150 109 150 109 47 47 28 28 28 6 120 120 6 18 18 59 59 18 32 32 32 73 73 73 672 631 631 352 311 32 380 483 374 408 275 395 275 234 ...

result:

wrong answer 100067th numbers differ - expected: '947582540', found: '-50661813'

Pretest #9:

score: 0
Wrong Answer
time: 895ms
memory: 63144kb

input:

9
4
100000
1 1 1 0
2 2 2 0
2 1 1 1
2 2 2 1
1 1 1 0
6 1 1 1
3 1 1 0
6 1 1 0
7 1 1 2
6 2 2 0
8 3 3 2
9 1 1 1
9 1 1 0
12 5 5 2
14 1 1 3
13 4 4 3
13 1 1 3
14 3 3 3
17 5 5 2
19 1 1 0
18 3 3 3
22 3 3 5
23 1 1 0
21 5 5 3
22 4 4 4
23 7 7 2
24 6 6 3
25 2 2 1
29 6 6 7
29 8 8 3
31 8 8 7
32 6 6 5
31 5 5 7
31 2 ...

output:

-1090519050 -1182793749 511705067 511705068 23 -1090519054 -1065353262 44 -1090519054 -1090519053 -1879048219 -1694498819 62 511705068 -1694498822 -1090519052 -1694498821 18 -1090519053 220 -1694498821 -1694498821 -1090519009 202 -1090519054 -1090519053 -1090519010 399 -1694498822 179 -1694498799 -1...

result:

wrong answer 1st numbers differ - expected: '4', found: '-1090519050'

Pretest #10:

score: 5
Accepted
time: 1281ms
memory: 65160kb

input:

10
4
100000
1 1 1 0
2 2 2 0
3 3 3 0
4 2 2 0
5 2 4 0
6 1 3 0
7 2 4 0
8 3 8 0
9 1 6 0
10 4 6 0
11 2 9 0
12 2 3 0
13 1 13 0
14 4 12 0
15 1 9 0
16 7 13 0
17 10 17 0
18 17 17 0
19 10 11 0
20 2 13 0
21 9 11 0
22 15 18 0
23 9 22 0
24 4 6 0
25 21 22 0
26 9 16 0
27 18 27 0
28 4 16 0
29 13 24 0
30 1 5 0
31 5 ...

output:

27 1160 73079 5773240 508043960 401903691 408194108 913457210 404309453 850776989 162033550 491800762 693950334 88591672 90581013 261837127 124549390 607776285 954584563 426982262 910735533 125508942 301425049 369545791 349157696 256736908 276834134 449249498 408190411 362993320 980271019 745442146 ...

result:

ok 399996 numbers

Pretest #11:

score: 5
Accepted
time: 1386ms
memory: 64920kb

input:

11
4
100000
1 1 1 0
1 1 1 0
2 1 2 0
1 1 1 0
2 1 2 0
6 1 3 0
5 1 2 0
7 2 3 0
6 2 2 0
8 1 3 0
9 2 3 0
9 3 5 0
10 2 4 0
13 2 4 0
12 4 6 0
13 1 6 0
16 1 4 0
18 6 7 0
18 2 4 0
20 1 6 0
21 2 9 0
20 1 3 0
23 1 4 0
22 1 8 0
24 10 10 0
23 3 5 0
24 3 11 0
26 8 11 0
27 1 9 0
30 2 11 0
28 12 12 0
32 4 8 0
32 9 ...

output:

41 1 42 3 3401 407995 8 65275757 3484 12 30977333 131377791 3443 65687153 608294415 197064986 558803128 3442 391883539 973952531 292262895 548293486 864139803 925368887 65687235 614731260 251165603 65687194 646118904 822181649 995485114 956758427 65275757 656989819 750355997 665993179 321752162 1997...

result:

ok 399996 numbers

Pretest #12:

score: 5
Accepted
time: 1384ms
memory: 64932kb

input:

12
4
100000
1 1 1 0
1 1 1 0
3 1 2 0
3 1 2 0
4 1 1 0
4 1 3 0
6 2 4 0
7 2 4 0
9 1 4 0
8 1 3 0
11 3 3 0
11 5 6 0
12 1 2 0
14 3 3 0
13 2 7 0
16 2 3 0
17 2 4 0
17 7 9 0
17 3 8 0
20 2 6 0
21 10 11 0
21 6 11 0
21 7 9 0
23 3 4 0
24 5 11 0
26 6 9 0
26 5 7 0
27 12 13 0
29 10 10 0
28 1 3 0
31 13 15 0
32 7 13 0...

output:

1 44 3430 45 363401 10424 49055705 17373 31271 763087444 528293936 364247389 57980118 763087444 558370737 701077016 687461217 3475 530193136 875194506 45 47291471 587072521 233025799 902397684 501363487 984008256 763090918 763087444 553932106 460519388 415423761 485110453 526953701 435687917 4594610...

result:

ok 399996 numbers

Pretest #13:

score: 0
Wrong Answer
time: 990ms
memory: 66020kb

input:

13
4
100000
1 1 1 0
2 1 2 0
3 2 2 2
4 2 4 1
5 1 2 4
6 4 6 2
7 1 6 4
8 6 6 5
9 5 8 8
10 6 6 1
11 8 11 5
12 8 11 1
13 4 8 6
14 4 7 1
15 11 15 5
16 1 1 10
17 6 9 7
18 8 16 2
19 2 9 10
20 6 20 7
21 12 14 11
22 9 14 14
23 6 7 22
24 12 14 11
25 20 20 21
26 10 20 0
27 19 26 8
28 21 23 12
29 4 13 23
30 15 2...

output:

28 55 26 109 25 246 162 79 24 1161 1052 1188 970 2125 699 480 1822 2880 993 4442 286 21 21 3699 298 9538 1352 622 189 189 1481 1505 15694 21512 834 834 5007 968 968 14494 725 23023 12855 17501 26963 26963 4370 55916 2673 2458 139790 114009 120206 117382 44163 44163 43673 53833 619 71600 8518 22800 2...

result:

wrong answer 1520th numbers differ - expected: '462976093', found: '-535268260'

Pretest #14:

score: 0
Wrong Answer
time: 1070ms
memory: 65112kb

input:

14
4
100000
1 1 1 0
2 1 1 1
1 1 1 0
2 1 2 1
4 2 2 1
5 2 2 1
7 1 4 1
8 2 5 3
8 5 5 3
10 2 3 5
11 1 6 5
10 1 4 5
12 5 8 1
12 3 6 5
13 3 6 2
15 2 5 8
17 6 7 6
18 6 8 5
17 10 10 1
18 4 5 5
20 4 11 7
22 8 9 4
23 9 13 12
24 9 13 10
24 6 8 7
26 3 13 13
26 11 14 11
28 11 11 2
27 9 16 8
30 6 12 0
31 13 17 16...

output:

38 -889302374 -889302372 37 -889302373 150 149 -889302335 34 33 109 -889302374 -889302148 69 -889302000 32 -889302074 -889302041 407 -889302374 406 329 30 -889302149 629 371 -889302149 -889302340 2558 1345 255 -889300798 -889301823 1826 -889301798 -889302374 2943 2943 15663 -889302131 -889293605 173...

result:

wrong answer 2nd numbers differ - expected: '0', found: '-889302374'

Pretest #15:

score: 0
Wrong Answer
time: 1124ms
memory: 65120kb

input:

15
4
100000
1 1 1 0
1 1 1 0
3 1 1 1
3 2 2 0
4 1 2 0
5 1 1 2
2 1 2 0
3 1 2 0
7 3 3 1
9 3 3 1
8 1 2 1
10 1 5 1
8 2 3 0
9 1 2 1
11 3 3 3
14 1 2 2
15 1 3 1
15 2 4 0
15 1 4 3
17 3 4 2
19 5 5 2
21 4 6 4
21 6 6 2
24 2 4 6
24 3 7 4
22 3 4 0
23 1 5 5
23 5 6 6
26 2 8 3
30 5 9 8
27 4 6 1
27 3 7 2
31 6 8 7
32 5...

output:

1040086636 69 1040086628 1040086630 1081928972 1040086629 -1963740327 1791 1081929044 1040086629 385674442 1123771251 -2047424894 1720 1040086628 -2089267178 1040088488 60684 1040086629 307456549 58823 385674443 -807220750 343832159 -807220751 254634 343832159 343832159 -2023770427 41842276 10401634...

result:

wrong answer 1st numbers differ - expected: '8', found: '1040086636'

Pretest #16:

score: 0
Wrong Answer
time: 1106ms
memory: 65852kb

input:

16
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
4 1 1 1
1 1 1 0
2 1 2 0
7 2 3 2
3 2 2 0
6 2 2 0
8 2 3 0
11 1 5 1
11 2 5 3
11 3 3 4
14 2 6 2
14 2 3 0
12 2 3 0
12 4 5 0
16 3 7 1
19 3 7 2
18 3 4 2
21 2 4 0
22 1 3 0
21 1 6 6
21 4 5 3
21 1 7 4
23 1 10 2
26 1 6 4
23 9 10 0
25 7 8 1
25 3 9 2
27 9 11 3
29 4 11 7
33 2 6...

output:

55 771737478 771737477 771737476 771737478 109 53 771737477 771737477 2332 2110 771737532 771737478 771737694 545238085 771739861 13499 545235700 545233150 13335 771814184 545366074 771737476 5359 771737746 771769135 771739861 771737750 424 771755635 771737641 771737694 771750975 771737476 260 77173...

result:

wrong answer 2nd numbers differ - expected: '2', found: '771737478'

Pretest #17:

score: 0
Wrong Answer
time: 1078ms
memory: 65584kb

input:

17
4
100000
1 1 1 0
2 2 2 0
1 1 1 0
1 1 1 0
5 1 2 1
5 1 2 1
6 2 2 2
7 1 1 0
8 1 1 3
8 3 4 2
6 1 3 2
9 2 4 1
8 4 4 0
11 1 4 2
10 3 3 1
11 2 5 0
14 2 3 0
17 4 4 2
14 3 4 4
17 1 4 2
19 2 6 6
17 1 1 5
18 1 5 3
23 3 7 2
22 2 3 7
24 4 6 3
23 1 7 4
23 7 7 5
27 5 6 2
26 6 9 5
28 1 7 4
30 1 9 5
29 2 6 6
29 4...

output:

343898209 343898208 343898208 54 51 343898209 49 1031694680 343898207 209 343898208 687796471 343898675 343898312 343898258 351 343898674 343898259 343898207 343898307 343898208 44 343898574 343898571 343898208 343898616 343898418 852 343898462 343898362 343898361 343898362 343898261 5015 343898361 ...

result:

wrong answer 1st numbers differ - expected: '2', found: '343898209'

Pretest #18:

score: 0
Wrong Answer
time: 1118ms
memory: 65692kb

input:

18
4
100000
1 1 1 0
2 1 2 1
2 1 2 0
2 1 2 0
3 3 3 1
5 1 3 1
4 2 3 2
7 1 3 1
8 2 4 0
9 1 4 1
8 2 3 3
12 2 5 3
9 2 3 2
11 1 1 1
11 2 4 1
14 1 6 2
15 7 7 0
17 2 4 4
18 6 7 1
17 2 6 6
17 5 5 1
20 2 5 7
22 1 7 3
23 6 10 7
25 4 4 6
25 8 11 7
26 2 10 3
26 6 7 6
27 12 12 2
28 1 1 0
29 8 11 11
32 3 9 12
30 2...

output:

60 377312637 377312699 1193 377312636 1132 377312638 10615 754625395 6733 377312636 377312696 377317528 2023 377325575 377318599 2023 377312635 2022 377312635 377326828 769 377325635 5541 13586 377317347 -1921140214 7379 377332309 452661127 646 646 377312635 377332308 377312635 120670 -1921142236 62...

result:

wrong answer 2nd numbers differ - expected: '2', found: '377312637'

Pretest #19:

score: 0
Wrong Answer
time: 1093ms
memory: 65516kb

input:

19
4
100000
1 1 1 0
1 1 1 0
2 1 1 1
4 1 3 1
1 1 1 0
6 2 2 1
5 2 2 1
6 1 1 0
5 2 3 1
9 1 3 0
10 1 5 3
11 2 4 1
10 2 5 2
13 1 2 2
15 1 3 0
16 1 3 1
16 3 4 6
14 6 6 0
18 6 6 1
19 1 7 2
21 6 6 4
20 9 9 3
21 1 4 5
22 4 8 7
24 2 9 8
26 7 8 0
25 1 2 8
28 1 9 8
26 2 5 3
30 2 2 1
27 9 9 3
30 4 9 2
29 3 7 8
3...

output:

38 -1317189258 37 873 -1317189254 192760162 -1317189222 1022698984 982 -1604179912 -1317189220 988788947 868 285034863 -767986135 -1830138972 -109229722 2647 -84775091 2646 712 -109229722 -226670202 675 -226670202 -1317188312 637 859 -226640449 -1845849345 -1317189222 -226641318 6060 -226670054 -226...

result:

wrong answer 2nd numbers differ - expected: '1', found: '-1317189258'

Pretest #20:

score: 0
Wrong Answer
time: 1103ms
memory: 65912kb

input:

20
4
100000
1 1 1 0
2 1 1 0
3 1 3 2
4 4 4 1
5 1 5 0
6 1 6 3
4 2 2 1
3 3 3 2
8 1 1 3
7 2 5 0
10 1 3 4
11 1 7 5
9 1 1 3
14 1 3 1
12 4 6 4
16 1 4 7
15 2 4 4
17 2 7 1
19 6 9 6
18 4 6 2
18 2 7 4
18 2 4 3
22 1 7 0
19 3 9 6
20 4 7 7
26 5 10 9
27 2 7 10
27 3 10 6
29 8 9 10
26 7 8 5
31 3 9 1
31 5 13 5
32 10 ...

output:

52 103 49 -1610770693 75181605 -310536613 200 -310537025 97 150362898 97 -310536872 -310537026 -1619318145 200 45 -1308781223 2993 2043 -1317328366 -1308781069 -1317328521 426710173 -1610771060 1839 -1610771161 -1610771264 -1610770475 -1610771264 5094 -520246328 -520249248 -520252158 -1610770918 243...

result:

wrong answer 4th numbers differ - expected: '571', found: '-1610770693'


Final Tests

Test #1:

score: 5
Accepted
time: 2ms
memory: 26652kb

input:

1
4
6
1 1 1 0
2 1 2 0
3 2 3 0
3 2 2 2
5 4 4 3
6
1 1 1 0
1 1 1 0
3 1 1 1
3 1 1 0
4 2 3 1
6
1 1 1 0
2 1 2 1
2 1 2 0
2 2 2 0
2 1 2 0
6
1 1 1 0
2 1 1 1
1 1 1 0
4 1 2 1
5 1 2 2

output:

4 11 5 1 1
1 2 1 2 3
5 1 6 1 6
1 0 2 1 0

result:

ok 20 numbers

Test #2:

score: 5
Accepted
time: 4ms
memory: 23124kb

input:

2
4
300
1 1 1 0
2 1 1 0
1 1 1 0
4 1 2 1
2 2 2 0
6 1 2 1
3 1 3 0
4 1 2 1
6 1 1 1
10 2 3 0
6 2 3 2
11 2 4 0
11 4 5 2
14 4 4 5
10 1 3 2
12 3 4 0
12 2 4 1
15 7 7 5
17 3 4 1
16 4 4 0
21 2 2 5
20 2 4 2
20 2 2 1
23 3 5 1
20 3 4 0
22 4 5 0
26 5 7 1
28 1 8 1
27 2 6 6
26 1 5 2
30 1 3 6
28 1 1 4
28 2 7 6
34 2 ...

output:

34 69 3 1 236 34 104 1 173 749 28 443 36 1 69 2124 271 1 2089 35 1 528 2124 2388 7628 444 4976 12140 35 2388 271 0 193 298 1 444 1 388 0 0 22121 5170 2423 89 9981 236 4511 29441 0 0 28 17308 12797 20 290 0 28 66702 24245 47192 29221 238597 12140 15625 92547 8753 45281 107649 11412 4241 91539 477 118...

result:

ok 1196 numbers

Test #3:

score: 5
Accepted
time: 2ms
memory: 26488kb

input:

3
4
300
1 1 1 0
2 1 2 0
3 1 3 0
4 1 3 2
4 1 4 2
3 1 2 0
5 1 5 0
4 1 2 3
4 1 4 3
5 1 2 2
8 5 6 3
10 1 3 2
9 4 5 3
13 4 6 1
10 1 4 3
12 4 5 5
13 1 2 1
13 2 3 4
18 6 7 6
17 6 8 3
19 1 3 3
21 9 9 4
22 2 4 5
21 5 7 4
22 1 5 1
23 3 9 3
24 1 1 6
25 1 2 7
28 1 8 6
30 1 11 2
30 4 9 0
32 2 10 3
30 6 8 8
32 6 ...

output:

25 249 447 129 26 274 929 1 16 0 78 1288 26 275 25 52 17 763 1 1951 3700 851 3253 825 2514 1857 3253 0 6382 19019 20093 9716 823 3914 2067 9277 585 8365 79274 36681 2789 274 274 22165 72494 0 53117 0 2789 300999 0 41180 139365 6759 0 6759 1288 46560 278623 56757 709247 195711 80845 3914 37444 36895 ...

result:

ok 1196 numbers

Test #4:

score: 0
Wrong Answer
time: 34ms
memory: 24508kb

input:

4
4
5000
1 1 1 0
2 1 2 1
1 1 1 0
4 1 1 0
1 1 1 0
3 2 3 2
6 1 2 1
5 1 2 0
8 3 3 1
10 1 3 2
8 2 2 0
11 1 5 4
11 3 5 3
13 4 5 3
12 3 3 1
16 1 5 1
13 4 5 5
18 1 5 5
17 1 6 5
17 1 5 4
20 5 7 4
19 1 1 7
23 1 8 3
23 4 6 4
23 8 9 7
24 3 4 2
27 3 6 3
28 5 8 9
26 1 4 4
27 3 10 8
28 8 11 9
31 4 6 3
31 10 10 2
...

output:

3 2 1 2 41 1 40 3 118 117 207 34 42 81 166 332 33 33 2 41 82 33 3462 235 42 3244 221 0 0 2957 121 99 6338 2342 40 1974 6298 375 11832 39000 0 18301 22749 1315 5762 0 14123 4460 5795 548 0 0 5520 548 33 548 106 9048 0 40 158 0 5137 5137 0 14387 0 30149 9193 2957 160 375 2 82113 375 384 14939 7233 711...

result:

wrong answer 1578th numbers differ - expected: '106067771', found: '-892176582'

Test #5:

score: 0
Wrong Answer
time: 40ms
memory: 24548kb

input:

5
4
5000
1 1 1 0
2 2 2 1
3 1 2 2
1 1 1 0
3 1 1 0
4 2 2 3
5 1 1 1
8 3 3 1
8 2 3 2
6 4 4 3
10 2 4 2
10 2 4 2
12 4 5 3
11 2 3 4
11 5 5 1
14 1 3 5
16 1 1 2
15 1 3 0
17 1 4 2
18 3 7 3
21 5 8 6
18 6 7 2
22 1 5 5
24 4 7 4
21 5 7 7
24 2 9 0
26 9 9 2
24 5 9 9
29 8 11 2
30 3 7 4
30 8 9 6
31 5 10 6
30 3 5 4
34...

output:

34 33 -1786773523 -1786773517 65 -1786773523 -1786773518 -184549401 -1786773519 32 -67108906 25165788 -276824096 -788529170 265 -486539286 264 -1577058243 -343933005 229 95 -788529135 223 -788528808 -788529169 -788528153 -788529169 26 5427 -788525577 -788528347 -788526335 878 -788529038 -788526961 -...

result:

wrong answer 3rd numbers differ - expected: '0', found: '-1786773523'

Test #6:

score: 5
Accepted
time: 1019ms
memory: 62336kb

input:

6
4
100000
1 1 1 0
2 2 2 0
3 2 2 0
4 2 2 0
5 3 3 0
6 3 3 0
7 6 6 0
8 3 3 0
9 5 5 0
10 2 2 0
11 4 4 0
12 6 6 0
13 8 8 0
14 6 6 0
15 2 2 0
16 2 2 0
17 17 17 0
18 5 5 0
19 15 15 0
20 2 2 0
21 14 14 0
22 17 17 0
23 10 10 0
24 23 23 0
25 10 10 0
26 17 17 0
27 23 23 0
28 21 21 0
29 29 29 0
30 7 7 0
31 21 ...

output:

13 116 1159 11577 150385 1654119 16540031 198480359 787928493 734581969 103223677 120676063 963754385 618704320 378636756 206516872 241703175 693677871 68103114 817225791 671888130 60162705 601476665 456558188 30918290 836035627 422508580 961059777 721412290 780076554 866081801 542037914 961741065 6...

result:

ok 399996 numbers

Test #7:

score: 5
Accepted
time: 1292ms
memory: 65096kb

input:

7
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
1 1 1 0
5 2 2 0
5 2 2 0
7 1 1 0
8 1 1 0
6 1 1 0
7 3 3 0
9 3 3 0
12 2 2 0
10 2 2 0
13 1 1 0
13 4 4 0
13 7 7 0
15 1 1 0
15 7 7 0
16 7 7 0
19 1 1 0
18 8 8 0
19 2 2 0
23 1 1 0
23 5 5 0
24 8 8 0
23 6 6 0
27 3 3 0
28 4 4 0
26 12 12 0
29 6 6 0
30 1 1 0
31 12 12 0
30 9 9 0...

output:

1 1 1 21 1 376 9022 162020 2 1 3879458 77588784 1 475771479 9043 1 475771500 836010287 21 836010287 21 723456114 723627157 3879458 171043 462547233 193433576 974019581 162021 821331611 162021 376 162020 686601685 418942555 31199510 217891022 462547233 836010287 944144826 217891022 575663750 44315401...

result:

ok 399996 numbers

Test #8:

score: 0
Wrong Answer
time: 746ms
memory: 61328kb

input:

8
4
100000
1 1 1 0
2 2 2 0
3 2 2 1
4 2 2 2
5 3 3 0
6 6 6 2
7 1 1 6
8 8 8 2
9 1 1 6
10 2 2 3
11 4 4 2
12 6 6 5
13 2 2 11
14 1 1 6
15 7 7 4
16 7 7 3
17 14 14 15
18 12 12 12
19 17 17 3
20 20 20 11
21 5 5 7
22 12 12 3
23 14 14 10
24 3 3 1
25 23 23 10
26 5 5 18
27 5 5 25
28 18 18 1
29 2 2 14
30 23 23 3
3...

output:

7 13 12 5 18 5 4 25 24 29 33 29 24 24 73 48 24 50 50 37 89 89 60 125 36 23 23 68 39 39 35 23 23 52 52 45 38 14 9 9 9 9 9 9 9 42 9 67 44 9 2 11 2 2 106 106 106 106 174 167 99 92 126 97 145 165 158 90 239 189 180 143 143 114 90 90 279 90 203 322 313 261 237 223 134 90 90 233 90 90 90 90 163 154 131 94...

result:

wrong answer 100088th numbers differ - expected: '883115705', found: '-115128648'

Test #9:

score: 0
Wrong Answer
time: 885ms
memory: 62856kb

input:

9
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
3 1 1 0
4 2 2 1
6 2 2 2
6 1 1 2
8 3 3 2
9 1 1 4
8 4 4 0
9 4 4 0
12 6 6 3
13 3 3 4
13 6 6 3
15 5 5 0
15 2 2 7
15 4 4 2
17 5 5 2
18 5 5 0
18 4 4 6
19 2 2 8
22 8 8 9
23 3 3 10
24 6 6 12
25 7 7 13
24 1 1 11
27 3 3 7
27 12 12 2
28 4 4 0
30 3 3 9
31 15 15 15
32 1 1 7
31 ...

output:

1 1 15 1 14 0 13 57 0 1 42 27 0 39 13 11 114 83 57 0 26 26 26 0 0 26 26 14 52 26 26 26 0 11 15 0 11 68 11 11 78 26 11 11 0 230 0 0 203 203 0 0 203 189 0 39 189 137 0 52 241 0 0 252 199 188 26 188 52 0 110 26 110 110 95 0 57 22 27 11 11 27 166 11 155 0 344 0 138 39 0 116 115 22 0 314 115 198 115 198 ...

result:

wrong answer 100000th numbers differ - expected: '5', found: '947882076'

Test #10:

score: 5
Accepted
time: 1265ms
memory: 65188kb

input:

10
4
100000
1 1 1 0
2 1 1 0
3 3 3 0
4 3 4 0
5 3 5 0
6 1 4 0
7 5 5 0
8 5 7 0
9 3 6 0
10 6 10 0
11 1 2 0
12 8 11 0
13 4 12 0
14 2 12 0
15 7 10 0
16 6 8 0
17 13 15 0
18 8 9 0
19 2 6 0
20 8 14 0
21 3 18 0
22 11 18 0
23 5 11 0
24 6 12 0
25 3 24 0
26 13 23 0
27 3 8 0
28 14 22 0
29 4 26 0
30 1 5 0
31 13 17...

output:

16 527 25807 1883910 167667973 634982620 705207129 488881034 887725160 151025554 347960978 855383206 80305903 380559379 538908054 777587576 260990688 523673420 353610155 624705377 700258326 228676702 200177699 984634103 68249951 263072670 517709689 650106087 34684922 592160972 944601706 376074738 79...

result:

ok 399996 numbers

Test #11:

score: 5
Accepted
time: 1383ms
memory: 65324kb

input:

11
4
100000
1 1 1 0
2 1 2 0
3 1 2 0
3 1 2 0
5 3 4 0
5 1 3 0
5 2 3 0
8 1 3 0
9 2 5 0
10 3 5 0
11 4 6 0
10 1 3 0
11 6 8 0
13 4 8 0
13 2 7 0
14 1 3 0
17 3 8 0
17 5 7 0
19 10 11 0
19 1 2 0
20 5 12 0
22 12 12 0
22 8 10 0
23 6 14 0
23 2 8 0
25 2 9 0
27 6 9 0
26 9 15 0
29 3 10 0
30 9 9 0
30 12 13 0
32 14 1...

output:

37 2478 2515 242769 38 245284 32040440 39124800 942462595 336524633 32285687 63297973 516597219 32285725 15628766 418384838 352153362 613054463 541763722 33194948 718423411 374189456 71408009 227001638 334965261 356495372 886316800 521955760 368374612 227507583 587492770 498900953 709154717 10323060...

result:

ok 399996 numbers

Test #12:

score: 5
Accepted
time: 1407ms
memory: 66676kb

input:

12
4
100000
1 1 1 0
2 1 2 0
3 2 3 0
4 1 3 0
2 1 1 0
4 2 2 0
3 1 2 0
8 1 4 0
8 1 3 0
5 2 5 0
9 1 4 0
10 3 5 0
11 1 6 0
11 3 6 0
11 3 3 0
14 2 6 0
17 3 7 0
14 2 4 0
14 4 6 0
18 2 8 0
18 6 9 0
21 8 10 0
22 5 5 0
20 6 8 0
22 1 4 0
24 3 9 0
26 3 8 0
25 3 3 0
24 6 7 0
25 5 9 0
27 2 9 0
32 4 6 0
32 9 11 0
...

output:

69 7796 1278127 262008169 69 7796 39327 94385 55058 777304836 141577 7866 482180153 1285993 1278127 465685418 825856966 42346779 575383498 990228081 154169563 7866 833831197 726620149 749228357 498747852 817824963 482180153 41068652 699428075 474778269 447467594 402643074 564999930 7866 869370470 84...

result:

ok 399996 numbers

Test #13:

score: 0
Wrong Answer
time: 991ms
memory: 66596kb

input:

13
4
100000
1 1 1 0
2 1 2 1
3 1 2 2
4 1 3 2
5 1 5 4
6 1 4 4
7 6 6 1
8 3 7 5
9 3 4 4
10 5 6 2
11 6 9 4
12 5 11 9
13 1 3 4
14 6 10 10
15 4 6 8
16 3 8 6
17 1 9 3
18 3 13 8
19 3 11 10
20 2 4 11
21 12 13 0
22 13 17 20
23 9 17 1
24 10 11 16
25 22 25 9
26 5 9 4
27 12 27 26
28 13 13 22
29 8 23 1
30 21 23 19...

output:

25 24 23 48 23 122 194 169 239 285 214 96 47 47 192 1948 2182 1132 385 216 455 47 1507 94 94 4391 21 779 13861 5938 14206 13992 4449 22496 12875 3304 3304 13811 13690 9811 3933 619 619 5401 13977 106342 3918 13555 35871 2821 276664 275227 172324 207717 203165 270061 269845 1838 68391 19507 19507 134...

result:

wrong answer 321st numbers differ - expected: '852213003', found: '-146031350'

Test #14:

score: 0
Wrong Answer
time: 1107ms
memory: 66120kb

input:

14
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
4 1 2 1
1 1 1 0
5 1 1 2
6 1 1 0
6 2 2 1
5 2 3 2
5 1 2 1
7 2 2 1
8 1 2 1
11 2 4 1
11 4 4 2
15 2 4 0
13 1 3 3
15 1 3 3
18 2 4 4
16 2 5 5
16 4 4 0
18 6 6 4
22 4 4 5
18 2 5 5
20 5 6 5
24 1 6 4
25 5 6 2
22 3 4 1
28 3 7 0
25 2 4 4
29 1 6 4
27 3 8 0
28 5 5 7
30 2 3 1
33 ...

output:

-243385098 -243385098 68 67 -243385097 -243385099 -730155293 -939639567 -243385098 337 -243385032 -184780312 -243384963 200 -847364328 -939639568 131 -847364867 -847364867 -243385032 131 -847364867 -847364867 -847364731 -847364732 603750538 1939 -847363527 452869370 -847364330 -336349440 62 58374009...

result:

wrong answer 1st numbers differ - expected: '1', found: '-243385098'

Test #15:

score: 0
Wrong Answer
time: 1113ms
memory: 66428kb

input:

15
4
100000
1 1 1 0
1 1 1 0
2 1 2 0
1 1 1 0
4 1 3 1
3 2 2 1
5 1 2 0
5 2 2 1
7 2 3 1
9 1 2 0
9 2 3 0
8 1 2 1
9 1 2 0
10 3 3 2
11 2 3 1
13 2 3 3
15 3 5 4
14 4 4 2
16 2 4 0
20 4 5 5
18 1 6 4
21 2 5 6
19 4 5 4
23 3 7 4
23 3 5 0
25 3 3 8
26 4 8 8
26 3 7 6
28 6 9 5
26 6 9 2
29 8 9 7
29 6 10 1
31 4 4 5
34 ...

output:

511577070 511577072 536486856 46 1023154138 511577071 511577160 44 536486861 310 511577114 511577113 511577159 1023154141 220 511577067 511577069 511577069 440 40 1023154140 40 511577068 511577467 3608 511577067 -1786901523 -1786901254 -1786900903 2369 511577157 -1786900858 1614 1614 -1786901169 -17...

result:

wrong answer 1st numbers differ - expected: '3', found: '511577070'

Test #16:

score: 0
Wrong Answer
time: 1102ms
memory: 66024kb

input:

16
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
1 1 1 0
5 2 2 1
5 1 1 0
5 1 2 1
4 1 2 0
7 1 2 2
6 1 2 0
7 2 3 0
12 1 4 0
11 1 1 2
13 1 4 0
14 3 3 4
12 1 4 0
16 2 2 1
18 1 7 5
19 6 6 5
20 4 5 1
17 2 5 4
22 1 3 4
23 1 3 3
21 5 5 9
22 3 4 3
24 1 7 3
23 2 5 1
27 2 5 4
25 2 8 7
29 6 7 3
27 5 9 6
30 10 11 6
30 1 2 3
...

output:

352182695 352182695 352182696 60 352182697 355 352182695 704365391 352182694 704365453 1360 352186245 352182696 704370714 352182696 1828 704365452 352182756 704365392 58303734 52 351 12001 352182695 352183049 24797 352186289 20363 174911509 19393 352183525 879276840 352182694 352186297 89801 3523095...

result:

wrong answer 1st numbers differ - expected: '1', found: '352182695'

Test #17:

score: 0
Wrong Answer
time: 1101ms
memory: 65304kb

input:

17
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
2 1 1 0
2 1 2 1
4 1 1 0
3 1 2 1
7 2 3 0
8 3 3 0
6 1 3 0
9 2 3 0
8 1 3 1
9 3 4 2
11 3 4 3
13 2 3 0
12 4 5 4
16 1 2 1
15 1 2 2
19 2 5 5
16 3 5 4
19 1 4 5
21 3 4 5
23 3 5 0
21 1 6 1
23 3 3 2
25 1 2 2
26 1 3 0
26 5 6 6
27 2 4 3
28 1 5 8
31 2 3 5
29 3 7 1
32 7 10 10
32...

output:

410992283 54 410992283 821984562 410992282 58472708 53 704197486 410992280 234732493 880457271 159 821984563 410992280 316 410992280 410992438 410992279 410992279 50 410992279 48 410992807 410993178 364 410992595 510 410992279 410992595 48 371 410992905 410992280 262 898 410992387 410993930 41099339...

result:

wrong answer 1st numbers differ - expected: '4', found: '410992283'

Test #18:

score: 0
Wrong Answer
time: 1094ms
memory: 65856kb

input:

18
4
100000
1 1 1 0
1 1 1 0
3 1 2 1
2 1 2 0
2 2 2 0
5 1 3 1
6 1 1 1
6 2 3 2
6 1 3 2
9 1 4 1
10 2 3 1
12 1 3 0
10 1 4 2
11 2 5 0
12 4 5 1
14 2 4 1
15 5 6 2
16 4 5 5
18 3 3 5
18 1 6 4
18 3 4 4
21 2 4 3
21 4 7 4
23 7 9 3
23 1 5 3
25 3 5 3
26 5 6 2
25 1 7 4
29 3 4 6
30 4 11 2
29 1 3 3
29 1 5 6
32 9 12 0...

output:

47 -67236918 -67236919 -67236824 44 -67236872 -369226804 40 -369226801 2679 -369226621 -1107680182 931007528 2627 -369226756 561780723 2495 -369226804 -369226804 2447 -369226804 37572 -369226673 40043 -369216192 -369221682 -369221498 37324 -369223994 -369178853 39005 -369226757 -369101314 66026 -369...

result:

wrong answer 2nd numbers differ - expected: '2', found: '-67236918'

Test #19:

score: 0
Wrong Answer
time: 1118ms
memory: 65924kb

input:

19
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
2 1 2 1
2 2 2 0
3 1 1 1
4 1 1 0
8 1 3 0
7 2 2 0
8 2 2 2
8 1 1 1
11 2 4 3
13 1 3 2
13 1 3 1
12 1 2 0
15 2 5 1
16 4 5 0
18 4 5 3
17 2 4 0
19 3 6 5
21 4 8 2
21 2 6 4
23 7 8 6
22 1 4 3
22 1 3 2
24 1 8 1
25 5 5 1
26 3 3 2
26 1 10 5
30 8 9 0
29 3 5 2
29 3 6 0
31 4 7 10
...

output:

469624715 469624713 43 469624713 469624713 469624712 515 469625271 939249425 469624713 427 469624713 469625227 880255571 1884 351635416 942 898 292641003 340 9674 469626727 469625785 469626596 7614 939256445 469625654 469628470 3978 1108 469635624 469636566 164 469624714 28792 469650651 469625270 47...

result:

wrong answer 1st numbers differ - expected: '3', found: '469624715'

Test #20:

score: 0
Wrong Answer
time: 1105ms
memory: 66200kb

input:

20
4
100000
1 1 1 0
1 1 1 0
1 1 1 0
3 1 2 1
5 1 1 0
4 1 2 1
5 1 1 2
8 4 4 0
8 1 2 3
10 3 4 0
11 5 5 3
10 3 4 2
11 2 3 3
12 1 7 6
14 1 2 1
15 5 8 3
15 1 2 6
17 5 8 4
17 3 4 0
18 7 9 6
20 1 10 2
21 1 4 9
22 1 9 9
23 3 8 6
25 3 7 8
24 2 7 6
27 1 9 8
27 12 12 8
29 3 11 3
30 2 6 4
31 6 14 8
30 6 8 3
33 8...

output:

150865151 44 150865152 43 150865193 150865151 42 150865151 41 172 85 150865237 150865150 41 150865322 816 150865195 150865320 1071 150865238 814 150865150 345 150865233 150865150 1228 150865191 1015 10639 150867459 150865574 5248 150865966 2504 150866213 3763 150868391 3634 150867449 150866434 2520 ...

result:

wrong answer 1st numbers differ - expected: '1', found: '150865151'