QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#525163#9159. 登山synonym0 150ms68432kbC++234.8kb2024-08-20 13:56:072024-08-20 13:56:07

Judging History

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

  • [2024-08-20 13:56:07]
  • 评测
  • 测评结果:0
  • 用时:150ms
  • 内存:68432kb
  • [2024-08-20 13:56:07]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 998244353;
const int UQ = 1420696969;

namespace segtree {
	const int LIM = 5e6;
	const int DL = 0, DR = 5;
	int cf[LIM], lc[LIM], rc[LIM], sv[LIM], ss[LIM], cc[LIM];
	int rt[LIM], rv[LIM], rx[LIM];
	int nxt = 1, rxt = -1;
	
	void reset() {nxt=1,rxt=-1;}
	int create() {
		cf[nxt]=lc[nxt]=rc[nxt]=sv[nxt]=ss[nxt]=cc[nxt]=0;
		return nxt++;
	}
	void pull(int v) {
		sv[v] = (cf[v]*ss[v])%mod;
		if (lc[v]) sv[v]+=sv[lc[v]];
		if (rc[v]) sv[v]+=sv[rc[v]];
		sv[v] %= mod;
		cc[v] = 1; //cleared
		if (lc[v] && !cc[lc[v]]) {cc[v]=0;}
		if (rc[v] && !cc[rc[v]]) {cc[v]=0;}
		if (cf[v]) {cc[v]=0;}
	}
	void buf() {rt[++rxt]=0;}
	void f(int v, int x) {
		cf[v] = ((cf[v]+x)%mod+mod)%mod;
		rt[++rxt] = 1;
		rv[rxt] = v; rx[rxt] = x;
		pull(v);
	}
	void push(int v) {
		if (!lc[v]) lc[v] = create();
		if (!rc[v]) rc[v] = create();
		f(lc[v],cf[v]);
		f(rc[v],cf[v]);
		f(v,-cf[v]);
	}
	void range_add_coef(int ql, int qr, int qx, int cp, int cl, int cr) {
		if (ql > cr || qr < cl) return;
		if (ql <= cl && cr <= qr) {
			f(cp,qx);
		} else {
			if (!lc[cp]) lc[cp] = create();
			if (!rc[cp]) rc[cp] = create();
			range_add_coef(ql,qr,qx,lc[cp],cl,(cl+cr)/2);
			range_add_coef(ql,qr,qx,rc[cp],(cl+cr)/2+1,cr);
			pull(cp);
		}
	}
	void range_add_coef(int ql, int qr, int qx, int cp) {
		buf();
		range_add_coef(ql,qr,qx,cp,DL,DR);
	}
	void clear(int ql, int qr, int cp, int cl, int cr) {
		if (ql > cr || qr < cl) return;
		if (cc[cp]) return;
		if (ql <= cl && cr <= qr) {
			f(cp,-cf[cp]);
		} else {push(cp);}
		if (lc[cp]) clear(ql,qr,lc[cp],cl,(cl+cr)/2);
		if (rc[cp]) clear(ql,qr,rc[cp],(cl+cr)/2+1,cr);
		pull(cp);
	}
	void clear(int ql, int qr, int cp) {
		buf();
		clear(ql,qr,cp,DL,DR);
	}
	void set_dp(int qi, int qx, int cp, int cl=DL, int cr=DR) {
		ss[cp] += qx;
		if (cl != cr) {
			if (qi <= (cl+cr)/2) {
				if (!lc[cp]) lc[cp] = create();
				set_dp(qi,qx,lc[cp],cl,(cl+cr)/2);
			} else {
				if (!rc[cp]) rc[cp] = create();
				set_dp(qi,qx,rc[cp],(cl+cr)/2+1,cr);
			}
		}
		pull(cp);
	}
	int merge(int r1, int r2) {
		if (!r1) return r2;
		if (!r2) return r1;
		rt[++rxt] = 4, rv[rxt] = r1, rx[rxt] = r2;
		f(r1,cf[r2]);
		rt[++rxt] = 2, rv[rxt] = r1, rx[rxt] = lc[r1];
		rt[++rxt] = 3, rv[rxt] = r1, rx[rxt] = rc[r1];
		lc[r1] = merge(lc[r1],lc[r2]);
		rc[r1] = merge(rc[r1],rc[r2]);
		pull(r1);
		return r1;
	}
	int MERGE(int r1, int r2) {
		buf();
		return merge(r1,r2);
	}
	void rollback() {
		assert(rxt>=0);
		while (rt[rxt]) {
			if (rt[rxt]==1) {
				cf[rv[rxt]] -= rx[rxt];
			} else if (rt[rxt]==2) {
				lc[rv[rxt]] = rx[rxt];
			} else if (rt[rxt]==3) {
				rc[rv[rxt]] = rx[rxt];
			} else if (rt[rxt]==4) {
				ss[rx[rxt]] = ss[rv[rxt]];
				pull(rx[rxt]);
			} else {assert(0);}
			pull(rv[rxt]); rxt--;
		}
		rxt--;
	}
	int get(int r) {return sv[r];}
}

const int mxn=1e5;

int n;
int p[mxn],l[mxn],r[mxn],h[mxn],d[mxn];
int sgt[mxn];
vector<int> adj[mxn];
int dp[mxn];

void dfs_depth(int v, int dep) {
	d[v] = dep;
	for (int u : adj[v]) {
		dfs_depth(u,dep+1);
	}
}

void dfs(int v) {
	for (int u : adj[v]) {
		dfs(u);
	}
	for (int u : adj[v]) {
		sgt[v] = segtree::MERGE(sgt[v],sgt[u]);
	}
	int lodep = d[v]-r[v];
	int hidep = d[v]-l[v];
	segtree::range_add_coef(lodep,hidep,1,sgt[v]);
	int bad = d[v]-h[v];
	segtree::clear(bad,segtree::DR,sgt[v]);
}

void undo(int v) {
	if (v) {
		dp[v] = segtree::get(sgt[v]);
	} else {
		dp[v] = 1;
	}
	segtree::rollback();
	segtree::rollback();
	for (int u : adj[v]) {
		segtree::rollback();
	}
	reverse(all(adj[v]));
	for (int u : adj[v]) {
		segtree::set_dp(d[v],dp[v],sgt[u]);
		undo(u);
	}
}

void solve() {
	segtree::reset();
	cin>>n;
	for (int i=0; i<n; i++) adj[i].clear();
	for (int i=1; i<n; i++) {
		cin>>p[i]>>l[i]>>r[i]>>h[i];
		--p[i]; adj[p[i]].push_back(i);
	}
	dfs_depth(0,0);
	for (int i=0; i<n; i++) {
		sgt[i] = segtree::create();
	}
	dfs(0);
	undo(0);
	for (int i=1; i<n; i++) {
		cout<<dp[i]<<" ";
	}
	cout<<"\n";
}

signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	
	int c,t; cin>>c>>t;
	while (t--) {
		solve();
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Wrong Answer
time: 0ms
memory: 26100kb

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 5 3 

result:

wrong answer 19th numbers differ - expected: '3', found: '5'

Pretest #2:

score: 0
Wrong Answer
time: 0ms
memory: 26156kb

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 386 280 18 525 195 0 145 490 0 0 1109 632 393 0 2517 0 393 625 189 0 11792 31551 5158 94653 15599 283909 74 265 425712 426170 19 18 211 0 19 0 9375897 102282527 14352680 16663356 6443226 51545808 143526818 412366464 18 304198653 0 437100518 356937125 713874250 786441197 72...

result:

wrong answer 11th numbers differ - expected: '349', found: '386'

Pretest #3:

score: 0
Wrong Answer
time: 0ms
memory: 26216kb

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 40 212 230 41 191 5094 77 0 4165 5999 136 0 4129 18747 0 3313 2868 947 2850 33987 67974 2850 2811 1 0 0 2811 103777 157495 0 311776 3214 0 3214 0 0 956046 1274268 2548536 38 2549860 0 7647793 1787 19130319 0 11471476 91825698 0 344346540 0 0 918257706 0 379141807 780 0 758285064 0 ...

result:

wrong answer 7th numbers differ - expected: '39', found: '40'

Pretest #4:

score: 0
Wrong Answer
time: 8ms
memory: 30816kb

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 28 83 25 29 108 111 1 79 21 0 29 104 133 133 533 381 2788 963 0 8364 352 0 12366 219 344 103 25435 600 153287 408858 1427 0 613260 1427 1226520 0 1294 1294 1016635 28 18243118 28 328376124 28 571856145 0 0 737355288 0 556107660 469631043 0 686153835 621954159 35249538 345113071 148380245 4372054...

result:

wrong answer 14th numbers differ - expected: '21', found: '104'

Pretest #5:

score: 0
Wrong Answer
time: 11ms
memory: 26608kb

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 69 5 35 277 583 35 0 479 1591 415 134 1245 1211 411 865 0 134 415 64 0 69 375 69 69 306 2901 1835 0 1765 0 0 1765 0 242 8922 139 103 725 8509 1722 216120 0 0 2593060 2828400 5656800 25459574 254595740 0 282884130 981944857 0 601263751 0 867848385 346264813 737452417 81100172 476660481 ...

result:

wrong answer 7th numbers differ - expected: '34', found: '69'

Pretest #6:

score: 0
Wrong Answer
time: 112ms
memory: 56036kb

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 1350 13500 202410 2226420 24490620 269396820 670560044 716134322 173632749 877928458 913645651 236856035 135215609 218696128 970020799 744232367 708625185 388160547 498711864 495429364 465886864 200004364 801794923 228443836 59505818 535552362 826993846 455234143 104129875 937168875 448565051 4...

result:

wrong answer 3rd numbers differ - expected: '1343', found: '1350'

Pretest #7:

score: 0
Wrong Answer
time: 126ms
memory: 61136kb

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 126 66 124 1491948 126 49150100 66 41443 124 32373056 1493247 41443 33 1 679834176 1298 301096754 1300 0 1 333564354 1298 0 1 0 17058014 82948 941630546 1535987 1298 1533391 82948 82886 862676579 1298 283377579 32 62 676328485 1299 0 1299 32 62 549391812 1...

result:

wrong answer 16th numbers differ - expected: '95', found: '126'

Pretest #8:

score: 0
Wrong Answer
time: 120ms
memory: 61344kb

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 23 23 44 88 176 44 373 21 21 21 100 100 100 100 100 100 100 100 100 100 77 77 77 77 77 77 76 76 76 76 76 76 76 99 99 99 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 53 53 53 53 53 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 ...

result:

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

Pretest #9:

score: 0
Wrong Answer
time: 137ms
memory: 61956kb

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 23 0 12 44 23 1 12 3 62 5 0 2 1 18 2 243 1 1 44 243 0 1 44 729 0 197 23 41 0 155 0 0 155 155 0 261 0 4537 6675 0 6936 215 23 215 67 0 148 23 67 0 85 40 85 0 85 0 40 40 0 0 40 18 29040 18 0 0 0 87120 18 85 0 0 261274 85 783822 85 0 0 2351466 85 0 62 18 7054336 85 10581532 21163064 0 10581476 ...

result:

wrong answer 7th numbers differ - expected: '11', found: '12'

Pretest #10:

score: 0
Wrong Answer
time: 121ms
memory: 57460kb

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 73080 5773320 508052160 402804997 835071373 897569777 361047670 428459987 194327361 48581636 622278008 907175141 203700504 975748518 501422990 307297603 13239989 206594646 831714432 817686837 460845593 2818452 250842228 346116406 857029544 403473031 567074373 18286154 592651045 650178912 423...

result:

wrong answer 3rd numbers differ - expected: '73079', found: '73080'

Pretest #11:

score: 0
Wrong Answer
time: 129ms
memory: 63696kb

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 3484 65687153 608705811 197064986 880809362 3442 352764748 825604695 537873079 213671211 52482980 307689163 65687235 402693624 710880135 65687235 119396760 678220738 65506421 413040500 65275757 399381199 906061390 844657413 246205655 914538...

result:

wrong answer 13th numbers differ - expected: '3443', found: '3484'

Pretest #12:

score: 0
Wrong Answer
time: 130ms
memory: 63540kb

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 49059135 17373 31271 763625954 529370956 473022979 589868515 884984473 717428223 168055400 125643850 3475 585780531 13133804 45 773984196 103702939 0 262407313 233910777 145607044 375397470 750794940 151317608 255212107 596791413 743412819 491564615 439158749 268018107 0 49...

result:

wrong answer 7th numbers differ - expected: '49055705', found: '49059135'

Pretest #13:

score: 0
Wrong Answer
time: 127ms
memory: 63420kb

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 137 53 246 162 162 107 3499 13996 55845 223054 595092 1785276 5355526 16066578 48199734 72299709 144599418 132 132 132 298 298 578399333 736953646 606308347 272 272 214373610 428747220 857494440 834 834 834 716747003 435249653 870499306 808 808 950819590 874335535 433796839 41844814 2929136...

result:

wrong answer 4th numbers differ - expected: '109', found: '137'

Pretest #14:

score: 0
Wrong Answer
time: 138ms
memory: 59372kb

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 0 2 37 1 150 187 39 34 33 109 0 226 107 449 107 300 1027 407 0 407 368 31 225 596 371 225 2499 14717 17542 255 53023 70723 1901 70722 75 113380 453520 1814080 0 2418339 2419566 1601 4839545 0 1001 775 0 14524060 0 38730935 0 58096277 58096490 0 250 1 39 174 39 174 512268189 0 0 553827348 28000391...

result:

wrong answer 7th numbers differ - expected: '149', found: '187'

Pretest #15:

score: 0
Wrong Answer
time: 141ms
memory: 62716kb

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 69 0 2 138 2 63 1791 143 1 8 143 46 1720 1 46 1860 60684 1 289 58823 9 146 0 146 254635 0 0 166 2 76796 174327 63 76796 66055 66055 110062 658531 3581 647225 1720 1860 1720 1289219 44147 5384654 3580 8065922 247967 781002 64264 3580 1565515 38565 0 3580 1860 2410712 64762629 0 0 1860 545635 323813...

result:

wrong answer 5th numbers differ - expected: '69', found: '138'

Pretest #16:

score: 0
Wrong Answer
time: 146ms
memory: 61144kb

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 2 1 0 2 109 53 1 1 2388 2110 56 2 218 7654 2441 13779 12867 23128 13779 64769 99870 0 5471 270 197078 2605 2662 424 37745 165 2662 0 0 424 0 0 202072 606110 315 204407 0 1616258 0 2426775 206 0 4776 78009 273506 119510 315209 1560275 627829 0 148 5616025 164 1872730 0 3760246 14975072 7488864 219...

result:

wrong answer 10th numbers differ - expected: '2332', found: '2388'

Pretest #17:

score: 0
Wrong Answer
time: 139ms
memory: 63720kb

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 54 51 2 49 59 0 209 1 59 468 105 51 351 467 52 0 100 52 44 467 364 106 514 211 852 463 155 154 463 54 10391 205 0 72373 0 337391 1686955 2108720 84845 106 576 6325746 1188869 54 0 154 8152393 16868569 9510903 47555746 8434883 25302777 57067312 171200670 872 16869766 872 684802367 258 913069786...

result:

wrong answer 12th numbers differ - expected: '57', found: '59'

Pretest #18:

score: 0
Wrong Answer
time: 143ms
memory: 65820kb

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 2 64 1193 1 1132 3 10615 125 6733 1 185 4893 2023 12940 8289 2023 0 2023 0 14193 2023 14193 16156 13586 4712 57507 45213 49766 0 646 1839 0 99532 2326 339877 445082 913294 2739882 1132 0 0 61 8219585 0 12342105 1254 26001 9948 0 9948 15547 49359018 15547 0 74033280 12940 23777 13001 8390 14844245...

result:

wrong answer 12th numbers differ - expected: '61', found: '185'

Pretest #19:

score: 0
Wrong Answer
time: 128ms
memory: 63240kb

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 1 37 911 5 1 37 18 982 54 39 30 868 6 132 168 6 3596 19 3596 712 19 3 712 985 985 712 859 63106 0 985 369588 6325 151 17380 1773893 100893 57512 153112 6653830 605358 231181 17743886 2906624 3637067 7263385 26618307 53236501 445 7274134 10894622 4919 3632630 1686 0 29095700 14548344 1686 10910416...

result:

wrong answer 4th numbers differ - expected: '873', found: '911'

Pretest #20:

score: 0
Wrong Answer
time: 150ms
memory: 68432kb

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 571 1191 415 200 2 200 2485 297 259 2 262 400 249 260 3945 2043 157 311 2 992 204 1994 103 0 18960 0 76760 86295 173750 52 28440 344707 155 261207 1292691 1723286 1320 3447282 103 41 5170768 53 1114 105 155 41 10342000 1114 15513078 15512922 1049338 457 362 757 1574283 457 757 0 457 757 0 ...

result:

wrong answer 5th numbers differ - expected: '1190', found: '1191'


Final Tests

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 28172kb

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 5 
1 2 1 2 5 
5 1 6 1 6 
1 0 2 1 0 

result:

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

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 26212kb

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 138 1 173 749 28 443 36 36 69 2124 271 237 2124 305 69 528 2124 2624 7663 513 12674 24884 513 2388 749 0 193 298 1 444 237 388 0 0 48707 0 2423 117 71863 236 25581 25303 0 0 28 25581 0 2144 2414 0 28 881598 106023 55408 318069 11239336 477121 2813212 24350060 24352483 36524014 97408...

result:

wrong answer 7th numbers differ - expected: '104', found: '138'

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 28328kb

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 954 1 16 0 103 1288 275 275 25 103 17 763 17 2647 3700 851 3269 825 6214 5509 3269 249 6382 58226 77446 96829 823 193572 289705 155269 610 60694 1170407 0 232904 274 274 161851 5851761 274 21945600 0 242777 87782151 0 0 351128141 6759 0 6759 117040218 234080436 936337446 220669...

result:

wrong answer 7th numbers differ - expected: '929', found: '954'

Test #4:

score: 0
Wrong Answer
time: 8ms
memory: 28604kb

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 4 118 118 207 34 42 81 207 414 33 114 2 41 82 73 3903 236 42 7316 11594 0 0 2957 121 0 63926 74130 121 355984 319630 444820 890239 796408 0 403716 1194830 2670717 807432 118 8011833 24035499 1614864 36053347 0 0 3229452 72106694 0 144213388 40 6458904 0 40 158 0 5218 5218 0 288426695...

result:

wrong answer 8th numbers differ - expected: '3', found: '4'

Test #5:

score: 0
Wrong Answer
time: 4ms
memory: 28628kb

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 0 6 65 67 5 1 4 65 14 7 7 0 265 7 265 228 18 229 95 35 288 1272 1 1339 133 91 11495 77251 25848 450778 156 132 2163781 77414 0 24 8114237 116252 24 21638043 132 132 24 32457181 132 132 64914362 13578 27055 129828559 194 0 34 53786 0 431500 0 3398019 107572 0 90 23300562 0 0 90 135919940 0 90 3...

result:

wrong answer 6th numbers differ - expected: '0', found: '67'

Test #6:

score: 0
Wrong Answer
time: 127ms
memory: 53796kb

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 1160 11600 150800 1658684 18245524 200700764 988708279 902883613 44636953 446369530 470717888 634862492 722540663 513399849 627621229 657369296 925101899 339962267 64927344 584346096 109644753 877158024 29553721 236429768 893193791 157839857 264474503 119307318 954458544 647957881 192441283 5...

result:

wrong answer 3rd numbers differ - expected: '1159', found: '1160'

Test #7:

score: 0
Wrong Answer
time: 141ms
memory: 62992kb

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 162396 3 1 3888106 77762120 3 556826231 9043 1 21 155836716 9043 0 21 122001261 171419 916314434 171419 525294993 996405690 963309756 171419 334487010 0 376 171419 365786696 960481106 0 280742660 0 0 342888775 0 438278852 390734357 24751161 0 86979359 86979359 396018576 173958718...

result:

wrong answer 8th numbers differ - expected: '162020', found: '162396'

Test #8:

score: 0
Wrong Answer
time: 124ms
memory: 64836kb

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 13 12 31 18 5 25 25 25 25 25 25 24 24 24 24 63 63 63 63 63 63 63 63 63 63 36 36 36 36 36 36 35 35 35 35 35 35 35 35 21 21 21 21 21 21 21 21 21 21 21 21 21 108 108 108 108 108 108 108 108 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 ...

result:

wrong answer 3rd numbers differ - expected: '12', found: '13'

Test #9:

score: 0
Wrong Answer
time: 139ms
memory: 66520kb

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 57 57 0 70 13 57 114 83 57 0 83 83 39 0 0 39 39 14 39 39 39 53 0 24 15 0 24 68 68 68 0 0 68 0 0 83 0 0 83 83 0 0 83 83 0 0 83 83 0 0 83 0 0 83 83 83 0 83 0 0 83 0 83 83 83 0 57 26 0 26 0 0 116 0 116 0 116 0 116 0 0 116 116 0 0 116 116 172 0 172 172 172 172 0 172 172 0 172 15 ...

result:

wrong answer 11th numbers differ - expected: '42', found: '57'

Test #10:

score: 0
Wrong Answer
time: 127ms
memory: 55480kb

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 25823 1885079 167772031 645908676 122447720 755630644 722527442 853063137 18061197 862058938 944656648 367116933 40953602 632605540 371159761 179024137 932259699 389245071 991221686 282553066 726089252 281397633 624370503 364057426 79614206 655253305 14923041 387417623 867877477 592323369 369...

result:

wrong answer 3rd numbers differ - expected: '25807', found: '25823'

Test #11:

score: 0
Wrong Answer
time: 120ms
memory: 66400kb

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 39127315 942910265 36489284 32285687 64198343 368076492 64326165 80277294 893821484 316221821 271995942 93589974 0 312745828 519962988 994551087 516272238 73614281 0 0 609109815 139613672 0 774704121 265688728 0 547421426 764782975 181093173 579142019 362186346...

result:

wrong answer 8th numbers differ - expected: '39124800', found: '39127315'

Test #12:

score: 0
Wrong Answer
time: 132ms
memory: 60844kb

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 777312701 141577 15731 484500397 1285993 1278127 25333544 830406601 526855041 582367825 384366564 470536443 15731 894857140 332982594 854887276 33730982 711530199 0 750221936 333670361 842144001 0 957609577 514345172 7866 555756117 216004332 693350...

result:

wrong answer 10th numbers differ - expected: '777304836', found: '777312701'

Test #13:

score: 0
Wrong Answer
time: 114ms
memory: 65340kb

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 97 72 122 218 218 411 2469 3897 267 243 243 8379 16758 33516 67032 219 219 219 219 94 94 94 44 44 811481 5680367 39762569 278337983 950121528 661384578 636714634 885809684 323636339 943573681 935474031 684392549 427229686 354305874 418979143 677672219 714200170 860311974 446514837 787814995...

result:

wrong answer 4th numbers differ - expected: '48', found: '97'

Test #14:

score: 0
Wrong Answer
time: 142ms
memory: 63140kb

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 68 67 2 0 4 1 1 337 134 4 136 268 539 6 131 0 337 67 131 0 0 271 270 2426 2275 3882 0 740 4852 62 0 12140 0 45961 674 61 61305 61440 1 674 61562 61 0 2890 123622 0 122591 268 123130 127559 185938 371001 255118 0 0 1009 740 604 0 508623 604 1009 1009 604 0 510031 3065297 7151870 10728075 14305209...

result:

wrong answer 11th numbers differ - expected: '67', found: '134'

Test #15:

score: 0
Wrong Answer
time: 124ms
memory: 64008kb

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 46 4 4 93 44 14 310 47 46 92 13 310 139 7 92 576 532 6 440 2 400 4896 90 0 269 800 2459 90 755 1704 1704 354 0 44 993 1303 0 8176 46364 0 0 185456 741824 989372 1977623 1977924 3955246 811 2966886 811 764 0 7923280 29712491 47 79233564 0 1980003 237700692 356551284 0 3960006 0 356550658 713102...

result:

wrong answer 9th numbers differ - expected: '13', found: '14'

Test #16:

score: 0
Wrong Answer
time: 128ms
memory: 61044kb

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 60 3 355 1 3 0 66 1360 3551 66 5326 2 1828 131 128 70 401 52 351 12001 70 355 26625 3946 20363 325 198539 831 2645 0 3603 789140 2105837 7935 23805 35708 48 6317511 2115472 0 0 18947569 0 3179866 0 28421531 9819 4208 6352276 6350268 19107023 2433 415 31763395 50965605 0 152896815 190580370 0 9...

result:

wrong answer 10th numbers differ - expected: '65', found: '66'

Test #17:

score: 0
Wrong Answer
time: 142ms
memory: 61208kb

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 54 4 4 3 19 53 38 1 9 24 159 5 1 316 24 159 5 0 104 0 48 528 899 364 316 564 0 316 48 687 1256 1 262 898 108 2399 1111 0 1214 0 790 4669 0 4717 524 5561 54 0 0 524 11068 11335 7605 528 13377 14204 478 212 28364 20515 44 478 40555 0 29668 0 81110 212 53 1576 1576 53 53 244376 305119 43 305818 30555...

result:

wrong answer 8th numbers differ - expected: '34', found: '38'

Test #18:

score: 0
Wrong Answer
time: 133ms
memory: 61976kb

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 2 1 96 44 48 0 40 3 2727 183 230 95 2627 48 94 2535 48 0 2447 0 38196 131 213235 97064 259040 148323 807043 2858 1071799 2156417 47 3225530 3243721 47 6450968 18454 171 12901765 12832 12972117 171 19456792 19505353 2859 52012831 2859 1 0 78019943 156039886 26002862 1485 1 624156868 1394 52008583 ...

result:

wrong answer 10th numbers differ - expected: '2679', found: '2727'

Test #19:

score: 0
Wrong Answer
time: 140ms
memory: 65864kb

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 43 1 1 0 515 559 2 1 427 44 515 1076 2399 1163 1457 942 2842 898 17769 2015 1588 42132 25559 10799 63198 46625 4493 1108 0 93250 164 2 58766 169149 558 5817 559 673211 33 3385 559 1794871 243911 2692285 43 0 731733 0 43 2195199 0 0 6585597 0 0 0 19756791 59262873 5999 559 88893110 88895509 5999 ...

result:

wrong answer 9th numbers differ - expected: '1', found: '2'

Test #20:

score: 0
Wrong Answer
time: 145ms
memory: 64364kb

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 44 2 43 43 1 42 1 41 172 129 87 0 129 172 816 45 170 3008 88 4770 0 345 83 0 10468 41 1015 146979 167957 335914 839917 0 5039502 12094841 12094838 18142261 36284514 36284522 72569044 54426940 0 338 0 0 338 0 251 108854469 168 217708938 0 168 435417876 168 42 548 0 435422919 0 180625889 0 0 1782250...

result:

wrong answer 11th numbers differ - expected: '85', found: '129'