QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#592204#9159. 登山thomaswmy15 1242ms46412kbC++142.4kb2024-09-26 21:10:432024-09-26 21:10:44

Judging History

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

  • [2024-09-26 21:10:44]
  • 评测
  • 测评结果:15
  • 用时:1242ms
  • 内存:46412kb
  • [2024-09-26 21:10:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
const int Mod=998244353;
typedef long long ll;

int cid,T;
int n;
int p[N],h[N];
vector<int> sons[N];
pair<int,int> a[N];
int dep[N];
int siz[N],son[N],dfn[N],rnk[N],num,top[N];
int stk[N],tp,dp[N],sum[N];

void dfs1(int u) {
	siz[u]=1;
	son[u]=0;
	for(int v:sons[u]) {
		dfs1(v);
		if(siz[v]>siz[son[u]]) son[u]=v;
		siz[u]+=siz[v];
	}
}

void dfs2(int u,int tp) {
	top[u]=tp;
	dfn[u]=++num;
	rnk[num]=u;
	if(son[u]) dfs2(son[u],tp);
	for(int v:sons[u]) {
		if(v==son[u]) continue;
		dfs2(v,v);
	}
}

map<int,int> mp;
int ans;

void add(int pos,int val) {
	ans=(ans+Mod-1ll*mp[pos]*sum[pos]%Mod)%Mod;
	mp[pos]=(mp[pos]+val)%Mod;
	ans=(ans+1ll*mp[pos]*sum[pos]%Mod)%Mod;
	if(!mp[pos]) mp.erase(pos);
}

void dfs3(int u,int mn,map<int,int> &mp) {
	mn=min(mn,dep[u]-h[u]-1);
	add(dep[u]-a[u].second-1,-1),add(min(mn,dep[u]-a[u].first),1);
	mp[dep[u]-a[u].second-1]=(mp[dep[u]-a[u].second-1]+1)%Mod;
	mp[min(mn,dep[u]-a[u].first)]=(mp[min(mn,dep[u]-a[u].first)]+Mod-1)%Mod;
	for(int v:sons[u]) {
		if(v==son[u]) continue;
		dfs3(v,mn,mp);
	}
}

void solve(int u) {
	vector<int> arr;
	int x=u;
	while(x) {
		arr.push_back(x);
		x=son[x];
	}
	int sz=arr.size();
	vector<map<int,int> > cng(sz);
	mp.clear();
	for(int i=sz-1;i>=0;i--) {
		dfs3(arr[i],dep[arr[i]]-h[arr[i]]-1,cng[i]);
		while(mp.size()) {
			auto it=--mp.end();
			if((*it).first<=dep[arr[i]]-h[arr[i]]-1) break;
			int x=(*it).first,y=(*it).second;
			add(x,Mod-y);
			cng[i][x]=(cng[i][x]+y)%Mod;
			add(dep[arr[i]]-h[arr[i]]-1,y);
			cng[i][dep[arr[i]]-h[arr[i]]-1]=(cng[i][dep[arr[i]]-h[arr[i]]-1]+Mod-y)%Mod;
		}
	}
	for(int i=0;i<sz;i++) {
		dp[arr[i]]=(dp[arr[i]]+ans)%Mod;
		stk[++tp]=arr[i];
		sum[tp]=(sum[tp-1]+dp[arr[i]])%Mod;
		for(auto j:cng[i]) add(j.first,j.second);
	}
	for(int i=sz-1;i>=0;i--) {
		for(int j:sons[arr[i]]) {
			if(j==son[arr[i]]) continue;
			solve(j);
		}
		tp--;
	}
}

int main() {
	scanf("%d%d",&cid,&T);
	while(T--) {
		scanf("%d",&n);
		for(int i=1;i<=n;i++) sons[i].clear(),dp[i]=0;
		dep[1]=1;
		for(int i=2;i<=n;i++) {
			scanf("%d%d%d%d",&p[i],&a[i].first,&a[i].second,&h[i]);
			dep[i]=dep[p[i]]+1;
			sons[p[i]].push_back(i);
		}
		dfs1(1);
		num=0;
		dfs2(1,1);
		dp[1]=1;
		solve(1);
		for(int i=2;i<=n;i++) printf("%d ",dp[i]);printf("\n");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 5
Accepted
time: 1ms
memory: 8796kb

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: 0
Wrong Answer
time: 3ms
memory: 10144kb

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:

13 12 23 1 26 9 32 0 0 9 157 99 0 253 120 0 63 230 0 0 67 254 213 0 388 0 204 361 114 467 2904 1441 91 957 562 913 25 127 562 1903 13 0 104 0 13 509 15424 5355 20479 12427 6971 756 5399 10769 0 10030 6334 753 203 1268 10407 10407 7316 562 3720 6162 0 8245 20324 72186 71550 5 0 185 9400 43436 82342 6...

result:

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

Pretest #3:

score: 0
Wrong Answer
time: 3ms
memory: 8752kb

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:

16 14 32 1 139 64 31 122 135 33 104 2599 44 0 2032 427 94 0 2018 2483 0 1708 1433 567 3781 4581 531 3751 1402 1 0 0 1402 36600 16389 26894 5131 7477 19805 1507 0 0 20552 21937 13696 30 6072 102535 12033 927 -30639 6533 12512 998191993 0 1688 12273 0 11998 15174 10836 158 0 158 10336 0 562 158 770 48...

result:

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

Pretest #4:

score: 0
Wrong Answer
time: 28ms
memory: 10988kb

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:

1 1 23 68 20 24 88 91 1 64 16 0 24 16 108 108 433 311 909 280 0 814 287 16 343 88 191 15 2624 176 1182 2083 1341 0 5593 784 5593 2690 608 608 11042 23 16534 23 15377 23 12534 0 3173 6671 0 63945 11898 51939 813 8088 79533 184 16358 15955 71442 103755 68241 3002 3800 3094 598 0 0 71602 31911 60440 37...

result:

wrong answer 3rd numbers differ - expected: '28', found: '23'

Pretest #5:

score: 0
Wrong Answer
time: 29ms
memory: 11444kb

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 23 2 3 22 5 22 3 23 113 178 1 0 132 675 180 21 518 495 21 338 0 88 157 42 0 1013 85 45 0 19 511 542 0 496 0 0 472 0 1426 909 68 44 292 423 578 3293 408 0 3676 3114 440 3108 5719 1184 707 4164 1446 3673 2747 491 1798 3348 2732 491 6983 6058 1241 490 24 1109 42 1369 146 2857 1623 1253 826 25412 2000...

result:

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

Pretest #6:

score: 5
Accepted
time: 1011ms
memory: 41388kb

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: 0
Wrong Answer
time: 683ms
memory: 30628kb

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 13 2 2 40 13 311 15 1 54 6505 26 41 17 39 142799 40 2557372 2 6505 26 27981476 143111 6505 1 1 419722127 311 726087901 481913238 726087901 726087902 370789615 311 27981476 1 27981476 85701847 147578711 940162945 149926 311 6505 147572206 6505 98892142 311 682779262 14 147565688 529093415 682...

result:

wrong answer 5th numbers differ - expected: '31', found: '13'

Pretest #8:

score: 0
Wrong Answer
time: 699ms
memory: 40572kb

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 100708th numbers differ - expected: '982889797', found: '-15354556'

Pretest #9:

score: 0
Wrong Answer
time: 582ms
memory: 28940kb

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:

4 6 0 1 13 0 11 11 0 1 5 2 998244350 1 0 2 1 10 1 37 1 1 12 27 0 1 11 47 0 23 13 10 0 82 0 0 35 35 0 46 0 120 37 0 0 998244303 13 998244221 51 35 9 0 122 0 10 998244336 998244350 109 998244350 82 998244240 998244336 0 0 998244303 37 998243418 10 0 0 0 998243539 10 998244177 998244336 0 998243686 998...

result:

wrong answer 5th numbers differ - expected: '23', found: '13'

Pretest #10:

score: 5
Accepted
time: 1238ms
memory: 46412kb

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: 0
Wrong Answer
time: 794ms
memory: 30012kb

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:

28 1 29 3 1454 106085 8 10713102 1511 12 297930456 21642794 1483 10820641 975615299 32463464 168665803 1482 491224415 841545197 737079587 56791264 58621379 528146885 10820697 453085577 632387431 10820669 915289526 457644777 196380483 35139674 10713102 945904722 515039664 934316836 891948465 57720527...

result:

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

Pretest #12:

score: 0
Wrong Answer
time: 824ms
memory: 32632kb

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 32 1854 33 153816 5660 15533562 9433 16979 881314762 764538987 826713054 530679805 881314762 272415830 42960637 982199293 1887 513881204 188251743 33 455601515 392494056 556841841 357060711 880805150 299306634 881316648 881314762 503424262 362222643 709646386 154676723 340207723 138987491 52307126...

result:

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

Pretest #13:

score: 0
Wrong Answer
time: 836ms
memory: 42880kb

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 3111th numbers differ - expected: '895277711', found: '-102966642'

Pretest #14:

score: 0
Wrong Answer
time: 711ms
memory: 31156kb

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:

34 0 2 33 1 100 99 35 998244349 29 97 0 168 61 266 28 200 195 295 0 294 225 26 167 493 297 167 998244349 1481 993 193 1098 389 1157 410 0 1946 1946 10592 215 5897 1078 857 4582 158 522 354 0 1101 0 13419 22691 1283 10485 21033 9168 1 11705 121 35 21 3348 47782 35049 60818 2473 388 678 47030 10982 34...

result:

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

Pretest #15:

score: 0
Wrong Answer
time: 587ms
memory: 25756kb

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:

8 44 0 2 44 1 55 878 91 1 8 48 38 832 0 29 922 19181 1 139 18258 9 67 0 129 60779 0 0 132 1 6185 57315 55 4431 21813 20891 36379 37439 1755 35456 832 0 0 32914 14656 418402 1754 205555 79266 37439 20935 0 149738 11888 0 1754 922 39149 154944 10616 0 2677 112343 413244 0 1755 1310340 109666 427403 24...

result:

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

Pretest #16:

score: 0
Wrong Answer
time: 641ms
memory: 31964kb

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:

34 2 1 0 2 67 32 1 1 930 827 35 2 134 3091 962 4381 2129 1065 4280 25354 44570 0 2255 165 10654 962 3 229 6272 102 998244321 4381 0 128 0 0 10450 162473 -6143 84723 0 160684 0 84694 26 78585 0 13158 46424 7020 7325 33071 6272 0 24 7101 101 6945 8661 29294 992 1856 19806 14650 81370 2550 80607 0 1792...

result:

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

Pretest #17:

score: 0
Wrong Answer
time: 674ms
memory: 31476kb

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:

2 1 1 26 24 2 22 31 0 99 1 29 222 50 24 162 221 25 0 46 1 19 175 172 1 191 101 173 119 73 72 73 26 931 72 0 778 383 2416 1312 525 425 51 118 642 1224 26 0 72 872 495 261 625 333 2063 4938 1021 137 333 137 2876 2003 307 0 2569 9802 0 121 2214 0 4002 5433 2353 0 0 2326 2587 9859 0 8198 0 0 4647 525 63...

result:

wrong answer 4th numbers differ - expected: '54', found: '26'

Pretest #18:

score: 0
Wrong Answer
time: 629ms
memory: 31444kb

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:

36 2 40 501 1 464 3 2932 77 2822 1 37 2077 856 3897 2504 856 0 855 0 4434 318 3933 1821 4141 1968 9286 3066 4153 9286 244 244 0 6719 0 20735 8431 998244280 6925 464 0 855 37 4019 3310 998240761 538 7867 2675 0 2138 3530 11289 3530 38276 3678 3897 4704 6073 1563 -11494 0 3934 23531 7612 998223743 0 1...

result:

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

Pretest #19:

score: 0
Wrong Answer
time: 614ms
memory: 31984kb

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:

25 1 24 399 5 1 24 18 469 49 26 25 394 1 102 26 1 813 19 812 293 1 3 269 3 447 244 292 11356 3 24 10961 1465 99 3117 8050 10216 7565 4092 38374 33893 3229 5064 30151 17970 3751 3388 2942 193 5753 3050 2304 2911 47725 1618 4143 4035 241 2040 2124 1138 0 2581 998242651 6368 244 918 998243857 0 0 2431 ...

result:

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

Pretest #20:

score: 0
Wrong Answer
time: 670ms
memory: 32472kb

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:

33 65 31 362 754 262 127 2 62 1310 62 98 1 167 127 29 100 1280 677 100 197 2 565 129 548 65 0 502 0 2020 2495 1657 33 220 1482 98 1207 2284 6287 3941 764 65 27 189 34 2440 67 98 27 539 483 1817 282 2190 773 229 2920 503 225 480 0 225 480 6805 12304 6036 67 604 0 0 998244327 998244226 6719 0 9848 0 2...

result:

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


Final Tests

Test #1:

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

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: 0
Wrong Answer
time: 3ms
memory: 10752kb

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:

18 37 3 1 71 18 56 1 73 271 16 162 20 1 37 630 90 1 611 19 1 174 630 717 1065 163 261 2412 19 717 19 0 65 105 1 19 1 116 0 0 4175 327 736 10 1763 71 1346 3902 0 0 16 2737 1391 9 80 0 16 10019 4805 6747 5066 22262 2412 4652 12921 2604 6156 10193 3411 1257 7590 126 2322 7503 2675 7413 8489 2048 1257 1...

result:

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

Test #3:

score: 0
Wrong Answer
time: 3ms
memory: 8744kb

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:

15 74 43 79 16 89 260 1 11 0 48 428 16 90 15 32 12 264 1 498 677 212 634 196 746 519 634 0 849 4495 4871 2131 268 1243 703 2348 233 2506 10609 7665 836 89 89 4465 9252 0 5622 0 836 41618 0 9141 13419 1386 0 1386 428 10843 47953 10822 94631 29822 17428 1243 7929 8231 4135 8501 30029 8233 2131 171843 ...

result:

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

Test #4:

score: 0
Wrong Answer
time: 24ms
memory: 10896kb

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 26 1 25 3 76 75 132 22 27 51 106 212 21 21 2 26 52 21 1167 151 27 1027 64 0 0 997 76 63 2355 728 25 492 2330 240 3314 13870 0 6590 8164 70 2211 0 4225 1034 -25 998243932 0 0 2078 998244083 21 998244083 998243935 3287 0 25 101 0 1833 1833 0 4672 0 8834 3220 997 102 240 2 27302 240 246 4998 23...

result:

wrong answer 5th numbers differ - expected: '41', found: '26'

Test #5:

score: 0
Wrong Answer
time: 28ms
memory: 10240kb

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:

22 21 0 6 41 0 5 1 4 20 14 7 7 0 169 0 168 61 18 145 60 23 140 230 1 646 1 15 1184 2285 523 1803 556 84 1405 835 373 14 986 273 14 2660 168 0 14 675 528 0 315 604 2724 274 80 145 22 2788 205 6223 145 4299 801 0 325 3211 345 0 13663 2770 2114 12 441 5508 4124 441 17018 2925 10927 3763 373 3701 2167 1...

result:

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

Test #6:

score: 5
Accepted
time: 1020ms
memory: 41388kb

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: 0
Wrong Answer
time: 672ms
memory: 27964kb

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 16 1 190 4178 54124 2 1 1024178 15362480 1 199653937 4194 1 199653953 184367453 16 184367453 16 31553261 31611564 1024178 58303 335727322 44633941 886847131 54125 586751811 54125 190 54124 89890407 194165228 229001394 63020521 335727322 184367453 562081024 63020521 635087631 927661827 93270141...

result:

wrong answer 4th numbers differ - expected: '21', found: '16'

Test #8:

score: 0
Wrong Answer
time: 689ms
memory: 40744kb

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 100182nd numbers differ - expected: '729902220', found: '-268342133'

Test #9:

score: 0
Wrong Answer
time: 615ms
memory: 30316kb

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 11 1 10 0 9 30 0 1 30 19 0 18 9 7 21 37 30 0 7 7 7 0 0 18 998244292 10 998244299 998244292 18 18 0 7 11 0 7 37 7 7 998244306 7 7 7 0 45 0 0 26 26 0 0 26 998244281 0 18 998244281 998244335 0 998244299 10 0 0 17 998244344 998244337 7 998244337 14 0 998244316 7 998244316 998244316 998244305 0 30 14...

result:

wrong answer 3rd numbers differ - expected: '15', found: '11'

Test #10:

score: 5
Accepted
time: 1242ms
memory: 46112kb

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: 0
Wrong Answer
time: 805ms
memory: 31244kb

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:

29 1623 1652 129781 30 131433 14142795 797888960 484346232 988601474 14274199 610672930 126150419 14274229 298265067 433000738 288622159 849320659 725329055 284077044 527278112 752469551 812161536 710631667 827129253 295859059 400584584 376672203 804284869 707504870 560419209 870957243 581354451 417...

result:

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

Test #12:

score: 0
Wrong Answer
time: 761ms
memory: 32384kb

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:

35 1994 175366 19112864 35 1994 8117 20293 12176 545344811 30439 2030 139371887 177396 175366 255732311 487931842 564633041 115538185 959741298 825928485 2030 958815449 346437160 161900547 223325670 449424728 139371887 564457675 899937563 874030326 571348285 987039590 148447690 2030 732197583 332139...

result:

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

Test #13:

score: 0
Wrong Answer
time: 854ms
memory: 42808kb

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 963rd numbers differ - expected: '884394970', found: '-113849383'

Test #14:

score: 0
Wrong Answer
time: 636ms
memory: 28496kb

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:

1 1 39 38 2 0 4 1 1 192 38 2 78 113 307 0 73 0 0 38 73 0 0 78 77 957 793 760 0 305 1762 33 78 2956 0 2810 1073 32 451 1354 1 38 -233 32 0 605 1511 0 259 0 7081 7144 5591 7120 10243 73 0 25023 382 20939 0 1282 6694 24793 305 70 0 6650 2564 60736 7351 1353 0 230 1928 52499 526 3067 39451 17791 78 183 ...

result:

wrong answer 3rd numbers differ - expected: '68', found: '39'

Test #15:

score: 0
Wrong Answer
time: 607ms
memory: 32520kb

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:

3 5 8 28 4 4 57 26 13 186 29 28 56 7 132 0 2 2 264 24 6 24 1 240 1788 0 0 161 372 1126 54 399 673 673 212 0 26 300 300 0 2605 2322 5184 4584 534 534 998244226 5014 3134 3226 998244226 2473 998243854 297 1812 2461 1777 29 11647 7740 8401 7111 6921 0 4272 0 632 2661 189 189 24309 2 28747 29 8346 2 119...

result:

wrong answer 4th numbers differ - expected: '46', found: '28'

Test #16:

score: 0
Wrong Answer
time: 640ms
memory: 31416kb

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:

1 1 2 34 3 167 1 3 0 39 467 1337 2 2005 2 697 38 36 4 5 28 129 2498 1 167 5286 1359 3719 192 3050 403 161 0 1365 1886 27648 124 208 165 25 27181 3173 0 0 25815 4936 5827 2627 12824 2065 1641 7941 13025 16774 973 0 25541 9413 7784 7502 20580 14553 4671 28737 7502 35 18614 7631 1469 17962 19522 14315 ...

result:

wrong answer 4th numbers differ - expected: '60', found: '34'

Test #17:

score: 0
Wrong Answer
time: 671ms
memory: 31348kb

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:

4 34 4 4 3 19 33 34 1 9 24 99 5 1 196 1 99 -4 0 30 0 28 328 559 224 196 310 0 196 28 95 386 1 27 258 68 1011 691 0 423 685 159 955 285 920 234 981 34 0 122 193 920 420 2031 328 1624 1199 298 132 948 777 27 132 449 0 1774 1758 955 132 962 1144 684 0 0 4394 2252 4645 492 1037 26 1959 421 325 7835 254 ...

result:

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

Test #18:

score: 0
Wrong Answer
time: 661ms
memory: 32012kb

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:

32 2 1 66 30 33 0 27 3 1192 125 158 65 1129 33 65 1039 0 0 1063 0 11883 89 10628 4642 2168 2321 9436 1281 16395 11448 32 36576 23241 32 36486 6846 57 36397 4346 86200 0 15114 61418 1282 88480 1282 1 78891 7178 27587 3232 596 1 3539 564 27024 69867 0 276274 1282 71175 415338 71086 13985 266671 381598...

result:

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

Test #19:

score: 0
Wrong Answer
time: 611ms
memory: 27572kb

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:

3 1 31 1 1 0 309 341 1 1 246 1 309 652 1110 344 555 523 654 183 4838 1204 649 1110 3632 4130 555 2150 2031 334 5544 6099 119 2 14934 14392 340 2832 341 18358 25 1697 1 4899 14689 13452 31 0 4188 523 31 2556 523 10501 2556 0 0 0 53160 29748 24432 11295 53743 13206 6213 52734 26594 550 0 50361 0 6408 ...

result:

wrong answer 3rd numbers differ - expected: '43', found: '31'

Test #20:

score: 0
Wrong Answer
time: 638ms
memory: 32280kb

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:

1 34 2 33 33 1 32 1 31 132 65 67 0 31 132 525 35 130 720 68 523 0 164 63 0 645 31 482 6465 1567 324 3163 525 1362 681 1957 1854 1858 1233 883 1105 0 846 0 0 61 0 61 15449 10351 4133 0 1352 3287 61 32 320 0 807 24458 19850 0 18570 -1026 0 0 971 96 30800 26 1276 14408 26 6491 12007 31701 26 29721 1362...

result:

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