QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#368059#7977. 彩虹航线zhaohaikun72 192ms173364kbC++20932b2024-03-26 19:26:102024-03-26 19:26:11

Judging History

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

  • [2024-03-26 19:26:11]
  • 评测
  • 测评结果:72
  • 用时:192ms
  • 内存:173364kb
  • [2024-03-26 19:26:10]
  • 提交

answer

#include <bits/stdc++.h>
#define F(i, x, y) for (int i = (x); i <= (y); i++)
using namespace std;
const int N = 151, M = N * N, T = 1e6 + 1;
int n, m, k, x[2][M], a[M], c[M][N];
unsigned short mp[2][N][T];
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count());
void dfs(int t, int f) {
	F(i, 1, k)
		if (!mp[0][x[0][t]][c[t][i]] && !mp[1][x[1][t]][c[t][i]]) {
			a[t] = c[t][i];
			F(j, 0, 1) mp[j][x[j][t]][c[t][i]] = t;
			return;
		}
	f = mrand() & 1;
	F(i, 1, k)
		if (!mp[f][x[f][t]][c[t][i]]) {
			int w = mp[f ^ 1][x[f ^ 1][t]][c[t][i]];
			a[t] = c[t][i];
			F(j, 0, 1) mp[j][x[j][w]][c[t][i]] = 0;
			F(j, 0, 1) mp[j][x[j][t]][c[t][i]] = t;
			return dfs(w, f);
		}
}
signed main() {
	cin.tie(0) -> sync_with_stdio(0);
	cin >> n >> m >> k;
	F(i, 1, m) {
		F(j, 0, 1) cin >> x[j][i];
		F(j, 1, k) cin >> c[i][j];
		dfs(i, 0);
	}
	F(i, 1, m) cout << a[i] << ' ';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 3ms
memory: 6848kb

input:

150 150 1
144 5 1
141 54 1
26 120 1
148 68 1
136 62 1
114 1 1
33 136 1
85 100 1
97 124 1
84 66 1
107 81 1
82 135 1
112 44 1
20 89 1
50 32 1
52 94 1
89 88 1
3 57 1
130 23 1
140 150 1
96 37 1
122 38 1
41 63 1
99 85 1
13 95 1
142 47 1
95 4 1
69 17 1
27 119 1
73 93 1
108 43 1
54 18 1
37 76 1
67 114 1
40...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 

result:

ok construction is correct.

Test #2:

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

input:

150 150 1
117 132 96
147 4 114
67 57 60
62 94 20
48 117 68
31 144 27
19 44 121
3 51 92
83 52 67
26 125 56
8 124 75
125 31 52
79 8 21
132 14 136
77 111 45
134 136 145
129 73 85
122 92 143
59 76 36
60 127 115
102 126 133
10 106 32
93 35 106
75 47 102
45 140 41
44 108 146
25 98 106
140 116 76
143 3 87
...

output:

96 114 60 20 68 27 121 92 67 56 75 52 21 136 45 145 85 143 36 115 133 32 106 102 41 146 106 76 87 90 116 15 147 51 35 85 15 83 43 105 89 12 89 140 103 114 135 78 93 80 87 93 19 7 125 132 96 96 99 48 1 63 3 6 146 116 48 9 126 6 106 64 74 84 16 23 119 51 7 83 96 56 94 97 27 15 51 106 95 32 70 103 75 8...

result:

ok construction is correct.

Test #3:

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

input:

150 10 1
35 145 1
145 88 2
130 14 1
111 142 1
138 99 1
76 73 1
101 79 1
147 137 2
65 64 1
108 8 2

output:

1 2 1 1 1 1 1 2 1 2 

result:

ok construction is correct.

Subtask #2:

score: 2
Accepted

Test #4:

score: 2
Accepted
time: 57ms
memory: 50968kb

input:

75 5625 150
11 6 680849 150419 731361 419631 223710 806977 837589 529911 568337 456216 515190 302854 672904 388629 548276 803173 770491 610684 550790 786097 253610 446581 705772 610053 637171 567249 365794 571846 431219 213414 466432 53255 748825 765338 761154 556712 159152 463622 706471 49434 59624...

output:

680849 124290 15612 557737 158942 192385 235793 769152 494833 786656 706961 179562 623504 384637 319911 538589 646445 182654 133375 167919 839028 430986 258463 733043 257852 48954 707925 759615 180153 738866 820974 796839 189152 345287 456191 534808 784528 237066 609402 13774 376476 28448 500736 422...

result:

ok construction is correct.

Test #5:

score: 0
Accepted
time: 29ms
memory: 8584kb

input:

75 5625 150
55 59 136 110 80 141 34 72 121 2 116 38 39 16 56 20 147 81 58 64 24 83 73 30 127 97 128 35 77 96 54 21 106 57 32 115 133 84 50 103 94 45 68 53 31 8 55 44 89 41 36 150 3 28 9 98 66 49 119 101 114 112 82 11 22 124 134 107 105 90 88 145 87 135 26 79 37 122 10 15 104 27 18 120 7 13 46 139 40...

output:

136 70 130 75 32 38 29 13 120 56 97 142 123 49 21 26 86 54 23 113 5 99 89 138 22 110 132 18 18 52 54 72 116 90 58 18 96 47 88 108 104 18 17 26 8 9 56 32 91 136 28 149 82 131 44 75 15 38 127 44 48 130 68 90 138 138 149 93 119 114 93 131 64 140 10 144 80 16 71 12 57 90 54 6 130 118 76 112 117 75 110 1...

result:

ok construction is correct.

Test #6:

score: 0
Accepted
time: 24ms
memory: 35128kb

input:

75 3750 150
1 29 15545 372923 77579 125076 509966 151564 332286 414939 296369 227609 9580 52174 99587 224186 2679 309545 38096 115252 281893 44718 259941 187595 500086 197842 267668 399469 254416 114691 268905 112134 257669 210411 135373 423915 537194 17707 204354 99757 234452 307155 82087 64190 309...

output:

15545 258915 129165 67229 472693 552406 146697 431843 406863 35443 208315 69147 134764 359917 406564 442868 153849 561136 548027 144054 467222 294395 349382 107391 408985 66032 380560 26261 109427 501390 539633 14950 439552 107122 536161 57467 29094 387263 16280 49644 358553 243796 156602 320287 976...

result:

ok construction is correct.

Test #7:

score: 0
Accepted
time: 23ms
memory: 8512kb

input:

75 3750 150
43 71 86 127 132 6 139 123 83 37 85 103 52 102 4 148 111 34 110 66 42 130 150 149 53 45 137 129 2 5 87 79 146 47 9 98 96 54 17 126 81 115 7 105 117 119 101 144 74 23 44 19 84 97 50 13 22 94 78 63 134 40 142 76 109 95 12 138 112 72 136 24 77 31 32 118 124 135 68 104 16 1 93 106 128 51 20 ...

output:

86 137 88 73 47 118 34 94 117 47 74 114 91 148 38 70 34 89 1 71 57 30 101 71 53 58 134 119 95 94 49 122 102 6 109 139 126 46 120 19 148 29 72 65 20 8 46 15 15 130 76 71 105 148 51 125 120 115 46 31 107 23 27 53 63 96 102 29 110 54 72 56 81 100 136 20 32 95 110 11 102 12 107 6 59 98 21 108 50 65 7 14...

result:

ok construction is correct.

Subtask #3:

score: 11
Accepted

Test #8:

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

input:

150 300 2
81 6 1 2
64 88 1 2
5 76 2 1
22 9 2 1
32 142 1 2
97 32 2 1
18 87 1 2
146 100 2 1
56 139 1 2
61 109 2 1
124 105 2 1
126 145 1 2
16 19 1 2
16 138 2 1
131 111 2 1
145 111 2 1
59 59 2 1
89 43 1 2
2 38 1 2
63 149 2 1
46 48 1 2
140 131 1 2
86 10 2 1
116 40 1 2
123 38 2 1
75 109 2 1
131 142 1 2
9 ...

output:

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

result:

ok construction is correct.

Test #9:

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

input:

150 300 2
60 122 3 1
114 17 2 1
21 19 3 1
134 75 3 1
64 81 2 1
52 33 1 3
45 27 1 2
148 91 2 1
110 100 1 2
100 74 2 3
53 130 3 2
59 19 3 1
149 108 3 1
19 92 1 3
85 66 3 2
80 89 3 2
16 4 2 3
39 90 2 3
53 102 3 1
20 21 3 1
21 112 1 3
76 98 1 2
7 130 3 1
140 129 2 3
139 100 3 1
127 77 1 3
136 113 3 2
54...

output:

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

result:

ok construction is correct.

Test #10:

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

input:

150 300 2
27 132 4 3
36 120 3 4
100 77 2 3
139 62 2 1
106 59 2 3
33 69 2 3
111 14 4 2
90 140 1 2
38 63 2 4
76 49 1 4
49 26 4 2
50 100 2 4
116 7 3 4
143 127 3 4
43 105 3 1
65 72 3 4
94 111 1 2
70 72 1 2
49 107 3 2
92 27 4 2
42 119 4 1
42 46 2 1
88 143 4 3
79 99 2 3
3 84 4 1
85 13 4 2
38 67 1 3
43 31 ...

output:

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

result:

ok construction is correct.

Test #11:

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

input:

150 300 2
87 61 2 16
114 49 13 10
25 34 13 18
19 62 2 6
44 60 10 14
132 71 20 18
40 51 13 17
67 25 13 18
125 40 19 14
82 53 19 8
66 118 19 3
38 136 6 12
150 135 14 7
75 53 10 1
54 33 4 8
69 19 8 5
129 72 13 17
149 74 14 10
136 117 1 18
13 80 4 18
107 11 13 18
41 14 3 10
15 90 3 11
104 43 6 18
52 80 ...

output:

2 13 13 2 10 20 13 13 19 19 19 6 14 10 4 8 13 14 1 4 13 3 3 6 10 12 14 2 7 7 16 1 19 6 10 8 9 12 7 5 14 8 12 3 19 5 2 17 13 16 5 12 18 4 4 9 20 17 11 11 16 4 8 12 19 20 20 15 16 2 8 8 6 10 16 16 6 2 17 9 6 4 11 16 18 12 2 18 16 4 7 20 16 11 11 7 17 11 5 9 20 4 3 12 11 7 14 17 2 19 12 1 15 2 19 13 10...

result:

ok construction is correct.

Test #12:

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

input:

150 300 2
46 114 441 328
119 80 69 102
9 78 444 336
8 47 230 59
60 140 548 248
147 131 36 399
68 86 447 183
97 13 461 318
31 93 536 570
35 41 237 149
53 77 156 95
123 119 562 202
94 26 519 23
129 128 438 80
74 139 454 108
92 68 559 399
140 61 11 178
106 137 15 575
140 15 22 289
65 50 263 546
9 45 31...

output:

441 69 444 230 548 36 447 461 536 237 156 562 519 438 454 559 11 15 22 263 31 195 67 389 27 283 415 253 30 535 552 302 507 41 549 414 291 324 239 404 185 284 118 295 201 463 12 264 277 502 64 583 167 154 150 197 46 368 467 594 548 468 467 172 299 551 260 203 301 598 113 270 101 199 429 242 172 594 2...

result:

ok construction is correct.

Test #13:

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

input:

150 150 2
138 25 1 2
71 40 2 1
146 116 1 2
110 122 2 1
59 36 1 2
147 145 2 1
80 88 2 1
38 13 1 2
137 6 1 2
57 84 2 1
25 84 2 1
125 75 2 1
73 128 1 2
94 69 2 1
27 18 1 2
89 119 1 2
8 131 1 2
62 3 1 2
32 67 2 1
77 77 2 1
78 6 1 2
142 70 2 1
61 16 2 1
21 129 2 1
2 126 1 2
136 128 1 2
141 35 2 1
65 78 1...

output:

1 2 2 2 1 2 2 1 1 2 1 2 1 1 1 1 2 1 2 2 2 2 1 2 1 2 2 1 2 1 2 2 1 2 1 1 1 1 2 1 2 2 1 2 2 1 2 2 2 1 2 2 2 1 2 1 2 1 1 1 2 2 1 1 2 1 1 2 2 1 1 1 1 1 2 2 2 2 1 1 1 1 2 1 1 1 1 2 1 1 2 2 2 2 1 1 1 2 1 1 1 2 2 1 2 1 1 1 1 2 1 1 2 1 2 2 1 2 1 1 2 1 2 2 1 1 2 1 2 2 2 2 2 1 2 1 1 2 2 2 2 1 1 1 1 1 1 2 2 1 

result:

ok construction is correct.

Test #14:

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

input:

150 150 2
73 97 3 2
50 90 3 1
106 133 1 3
2 65 1 2
47 141 3 2
75 24 1 2
93 85 2 1
14 12 3 2
53 15 2 1
136 120 1 3
68 49 1 2
13 127 2 3
26 87 1 3
78 79 1 3
130 97 3 1
3 8 3 1
55 3 3 1
122 27 3 1
39 51 2 3
72 64 2 3
85 98 2 1
148 18 2 1
90 110 3 1
21 89 2 1
116 75 1 2
52 99 1 2
41 29 1 3
60 130 2 1
10...

output:

3 1 1 1 3 2 2 3 1 1 1 2 1 1 1 3 3 3 2 2 1 2 3 2 1 1 1 2 2 3 3 1 3 3 2 2 2 1 3 1 1 3 3 1 2 2 3 3 2 1 1 3 2 3 3 3 3 3 3 1 3 1 1 1 3 3 1 3 3 2 2 2 1 1 2 3 2 2 2 2 3 2 1 3 1 2 3 2 2 3 3 2 2 3 1 1 1 1 2 3 3 1 3 2 1 2 2 3 3 2 1 1 1 1 1 3 3 2 3 3 1 3 2 3 3 2 2 3 3 3 2 3 2 1 2 2 3 2 2 1 3 2 1 2 2 1 1 2 1 3 

result:

ok construction is correct.

Test #15:

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

input:

150 150 2
134 2 3 4
139 116 2 4
100 69 1 4
45 66 4 2
24 64 2 3
93 43 4 2
137 144 1 3
40 105 1 4
134 108 2 4
98 40 3 1
20 144 3 1
11 51 3 2
101 89 1 3
46 53 1 2
39 23 1 3
109 40 2 3
30 7 2 3
142 6 1 3
38 112 4 2
108 28 1 2
111 32 1 4
28 49 4 2
89 14 2 4
65 143 4 3
43 8 1 2
92 56 4 2
106 53 2 4
117 14...

output:

3 2 1 4 2 4 1 1 2 3 3 3 1 1 1 2 2 1 4 1 1 4 2 4 1 4 2 2 2 4 4 3 1 4 4 3 4 2 2 3 1 3 4 4 3 1 1 2 4 1 3 4 4 2 2 2 2 4 2 2 1 3 3 1 3 1 1 1 3 3 3 1 1 4 1 3 1 2 2 2 2 2 2 3 2 3 3 1 3 1 3 3 4 4 3 4 1 4 4 1 1 3 4 2 1 2 4 3 1 2 3 2 4 1 2 3 1 3 2 4 3 1 1 2 4 4 4 1 2 3 4 2 3 3 1 3 2 4 2 2 3 2 3 1 4 2 1 2 2 4 

result:

ok construction is correct.

Test #16:

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

input:

150 150 2
42 118 2 5
44 13 7 14
95 7 20 11
92 142 11 19
96 150 10 18
11 52 6 18
66 48 1 13
17 5 13 16
91 22 8 20
19 71 15 6
73 61 10 5
50 63 3 14
101 143 20 5
52 114 12 17
111 60 19 9
20 4 6 7
54 63 16 18
31 31 9 4
33 148 10 8
37 32 17 19
60 57 20 8
31 136 8 1
65 87 19 4
138 72 6 17
71 112 8 20
83 3...

output:

2 7 20 19 10 6 1 13 8 15 10 3 20 12 19 6 16 9 10 17 20 8 19 6 8 11 2 18 2 8 13 10 2 19 8 11 1 20 9 10 18 20 15 3 9 4 8 13 14 17 13 9 19 16 1 19 10 8 5 16 18 9 8 18 20 17 20 7 15 16 5 8 1 3 5 7 10 5 14 7 8 15 9 15 6 17 5 16 5 7 20 20 1 17 12 11 16 5 20 14 2 13 20 18 6 7 17 10 9 3 15 16 15 19 18 20 10...

result:

ok construction is correct.

Test #17:

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

input:

150 150 2
137 126 61 39
96 140 224 95
145 72 296 11
23 92 241 36
98 129 102 20
90 41 85 39
41 113 188 148
93 131 282 107
10 76 23 225
8 16 16 124
115 135 270 30
20 129 88 48
110 125 94 272
101 98 56 238
106 116 125 110
73 138 234 193
22 127 245 8
58 29 8 140
86 36 212 170
40 97 288 204
30 50 109 75
...

output:

61 224 296 241 102 85 188 282 23 16 270 88 94 56 125 234 245 8 212 288 109 280 286 221 280 129 92 76 94 197 87 43 88 43 79 145 215 197 232 98 294 12 85 9 227 243 205 188 127 114 296 215 25 242 55 104 14 161 278 209 266 151 99 132 174 222 259 204 198 145 2 245 133 149 26 220 138 112 47 128 101 93 191...

result:

ok construction is correct.

Subtask #4:

score: 37
Accepted

Test #18:

score: 37
Accepted
time: 129ms
memory: 20240kb

input:

149 22201 150
106 24 20 90 56 109 85 33 76 25 97 77 134 75 15 24 88 16 93 126 43 94 116 120 28 130 21 140 70 111 71 32 29 41 132 39 84 62 27 92 55 117 129 125 127 104 74 114 14 145 36 121 22 69 68 133 59 65 58 148 131 40 54 118 110 3 61 105 4 112 142 122 73 37 1 113 45 87 57 89 103 98 100 63 146 106...

output:

85 89 71 122 72 28 54 123 66 103 141 142 111 100 82 147 144 51 134 13 39 17 57 120 82 118 137 125 76 78 105 51 10 64 9 55 115 26 86 124 57 97 148 115 25 40 64 110 70 64 131 37 75 78 131 17 85 131 133 20 98 131 26 38 101 60 92 43 59 133 105 55 16 93 46 126 41 44 108 147 88 95 27 23 65 24 66 147 65 11...

result:

ok construction is correct.

Test #19:

score: 0
Accepted
time: 120ms
memory: 18432kb

input:

149 22201 150
59 87 57 143 9 144 61 104 129 116 26 50 73 24 138 78 82 137 4 100 81 69 101 140 102 115 149 18 42 54 16 28 75 74 130 70 35 12 29 36 2 121 62 37 21 64 71 133 110 96 58 67 59 128 124 56 106 103 53 107 49 141 90 105 8 1 65 13 146 77 83 22 134 84 108 119 44 15 32 88 17 79 48 33 46 120 111 ...

output:

57 33 12 39 123 68 38 78 76 65 124 107 118 144 98 113 83 130 58 120 118 66 50 100 5 81 4 39 10 95 57 71 1 113 120 16 84 83 20 78 97 46 120 150 87 98 127 102 6 69 127 29 141 109 120 148 92 85 84 52 85 116 72 44 15 40 5 132 127 73 145 94 40 134 81 107 48 61 6 1 71 5 21 38 125 130 125 15 92 79 50 29 13...

result:

ok construction is correct.

Test #20:

score: 0
Accepted
time: 126ms
memory: 18608kb

input:

149 22201 150
85 67 67 47 152 75 90 126 113 128 46 30 36 85 21 97 79 16 61 39 120 99 153 105 76 107 56 116 118 119 122 94 9 127 12 15 68 104 80 7 100 146 125 95 53 112 74 143 81 27 1 52 40 71 29 88 139 69 13 11 92 132 45 42 38 151 3 60 24 91 2 25 86 133 41 10 33 135 82 57 110 6 114 140 138 62 87 64 ...

output:

67 120 108 64 17 83 79 129 31 36 43 25 145 34 62 128 119 114 74 46 48 80 90 152 111 19 28 8 125 9 130 69 133 136 111 27 78 20 125 136 60 93 3 24 47 127 99 72 23 52 84 150 21 35 144 82 133 76 42 125 123 75 47 1 146 69 44 121 112 91 136 133 30 127 126 58 64 22 135 21 115 10 12 71 151 40 108 65 1 85 3 ...

result:

ok construction is correct.

Test #21:

score: 0
Accepted
time: 137ms
memory: 19524kb

input:

149 22201 150
20 14 155 45 96 11 71 74 38 143 146 165 31 128 56 133 137 127 4 75 108 44 69 77 141 55 113 22 163 54 67 29 23 37 63 148 25 117 97 65 89 76 51 112 139 151 109 66 82 114 13 80 73 119 61 84 53 40 156 24 20 164 50 122 124 158 8 118 7 120 160 154 152 145 46 138 30 162 132 16 59 15 91 94 52 ...

output:

155 144 36 154 8 97 154 57 131 46 30 70 84 61 115 128 84 20 115 71 99 22 80 11 9 89 141 41 89 14 73 138 155 73 18 121 67 29 123 57 78 58 19 108 98 159 166 46 70 26 66 135 3 163 96 54 39 15 156 51 138 164 68 8 76 146 132 78 3 44 44 164 162 42 147 6 60 10 95 75 103 31 36 19 158 86 169 60 152 4 161 38 ...

result:

ok construction is correct.

Test #22:

score: 0
Accepted
time: 173ms
memory: 172332kb

input:

149 22201 150
64 32 323179 933179 87351 997262 611605 404909 732640 452641 642757 539724 945803 438567 594564 413639 542011 13240 428009 469975 976134 998911 916345 580907 215711 24916 933666 193524 159822 766638 161868 151754 502972 194801 55497 466348 151018 849178 317067 34382 293653 929582 83436...

output:

323179 232264 274375 353614 98058 929057 425283 25234 532070 236122 536497 362771 407552 109535 354105 993790 737557 556598 80040 318509 696056 386732 37527 677940 455579 277129 445951 507966 434746 13755 910960 791162 222986 532308 12821 228067 651165 244784 810569 207785 886393 558547 133563 1884 ...

result:

ok construction is correct.

Subtask #5:

score: 21
Accepted

Test #23:

score: 21
Accepted
time: 172ms
memory: 19056kb

input:

150 22500 150
117 116 91 74 113 95 110 26 141 115 38 66 71 138 17 83 112 99 149 18 3 44 15 28 53 114 96 37 7 145 20 109 80 19 117 16 63 27 42 137 135 132 14 39 1 148 147 30 68 126 12 32 57 67 119 139 124 46 133 24 36 51 69 88 131 60 86 140 102 29 100 150 35 123 84 85 90 105 75 45 77 143 130 127 98 7...

output:

71 98 67 106 93 109 63 23 138 150 3 105 95 101 60 67 126 17 117 122 150 67 43 5 65 31 13 74 107 6 108 47 144 97 40 148 131 5 28 137 130 109 22 12 135 71 94 32 139 16 54 109 16 86 132 99 51 26 80 86 72 125 146 118 105 57 30 143 68 149 100 134 130 115 39 22 74 125 67 16 113 102 100 75 146 82 50 92 119...

result:

ok construction is correct.

Test #24:

score: 0
Accepted
time: 130ms
memory: 20184kb

input:

150 22500 150
147 68 107 8 61 49 133 15 148 55 122 84 72 75 29 19 118 99 51 79 142 117 11 50 149 69 87 45 73 92 41 110 56 144 128 47 77 78 141 48 31 53 136 103 94 26 145 151 121 46 101 58 38 10 102 126 22 140 138 40 129 96 82 150 95 30 27 100 28 13 114 74 81 52 116 17 4 143 66 90 20 2 111 21 7 91 68...

output:

107 87 131 82 51 54 51 16 51 14 80 78 74 115 140 23 131 57 36 87 100 66 66 144 32 32 110 142 21 146 76 122 21 119 130 73 114 25 108 144 61 40 70 129 36 68 90 7 9 93 76 133 111 142 8 142 104 10 90 50 48 147 61 58 120 130 79 47 6 84 89 93 122 65 107 38 146 135 120 95 11 77 12 147 70 149 15 44 133 113 ...

result:

ok construction is correct.

Test #25:

score: 0
Accepted
time: 137ms
memory: 20404kb

input:

150 22500 150
53 59 70 142 54 108 56 6 22 92 39 80 38 84 125 144 117 127 74 71 40 140 33 146 145 72 85 44 128 45 86 94 93 66 34 52 21 59 57 137 78 120 63 67 13 124 2 126 60 76 79 102 116 100 23 150 58 115 107 82 104 138 97 151 106 131 152 42 132 77 32 11 89 55 30 31 95 49 65 96 141 135 17 114 143 14...

output:

115 73 127 125 3 80 118 31 62 100 93 109 136 82 60 147 136 82 63 3 96 142 74 50 22 100 52 6 20 70 104 87 14 109 24 134 39 60 15 50 78 3 101 4 149 89 19 134 12 75 128 107 72 148 109 106 130 125 125 102 33 125 132 146 135 35 112 107 90 3 90 59 144 93 104 73 117 82 14 150 20 135 22 147 32 81 93 22 96 1...

result:

ok construction is correct.

Test #26:

score: 0
Accepted
time: 139ms
memory: 20324kb

input:

150 22500 150
81 87 83 67 109 57 147 69 102 72 25 29 39 94 56 73 27 41 81 53 144 101 135 117 127 96 5 145 155 22 87 106 38 19 14 86 58 97 20 35 65 124 47 93 50 10 75 80 52 31 76 154 126 78 91 113 42 118 9 115 15 51 149 141 119 134 92 74 64 129 66 103 110 49 85 143 133 148 12 61 142 151 131 153 21 34...

output:

83 6 96 100 19 63 133 108 94 31 147 145 1 32 72 45 149 3 31 140 2 98 123 4 23 40 126 148 62 143 113 3 59 93 93 2 91 53 127 120 132 100 141 101 50 130 71 95 67 32 84 70 36 132 141 91 37 148 147 66 42 103 119 53 139 30 133 76 95 119 154 132 100 10 75 76 154 4 138 98 154 3 108 129 76 74 97 76 134 3 59 ...

result:

ok construction is correct.

Test #27:

score: 0
Accepted
time: 139ms
memory: 19696kb

input:

150 22500 150
21 135 30 53 162 62 34 163 112 104 16 67 48 161 137 99 94 93 158 20 70 91 12 148 40 24 141 131 29 132 14 44 31 7 167 146 35 113 45 39 136 84 142 108 87 123 129 85 58 134 5 166 28 73 128 56 80 147 155 6 149 76 41 36 88 66 121 86 168 97 63 47 26 116 169 151 95 15 100 19 50 103 98 126 38 ...

output:

30 170 31 62 50 131 83 38 39 94 115 86 27 1 35 120 39 23 146 27 101 140 166 129 22 4 146 89 100 28 149 65 37 127 78 154 18 114 148 44 48 52 20 4 159 170 139 69 169 39 51 135 87 168 128 103 103 150 42 13 160 122 64 30 45 81 59 8 48 119 90 98 144 138 101 138 118 10 111 158 15 154 74 99 97 71 110 31 68...

result:

ok construction is correct.

Test #28:

score: 0
Accepted
time: 192ms
memory: 173364kb

input:

150 22500 150
142 84 95127 811376 352518 34572 172491 645409 426070 585385 839136 465937 516075 461423 149284 929627 554965 743036 475305 268781 574670 840165 214086 131675 655651 402556 295405 797734 729790 132978 283490 807542 165311 188276 808619 466578 568749 15488 450230 528624 262879 824125 58...

output:

95127 64546 319281 123015 957211 69651 131744 667938 188419 393649 720559 666316 880577 980208 13144 624881 641541 378004 781889 560317 43193 228779 32833 542828 18776 681467 144117 435173 564509 198189 870717 297308 324299 340514 296371 612260 114278 673672 83929 993964 689038 30360 169180 455546 6...

result:

ok construction is correct.

Subtask #6:

score: 0
Time Limit Exceeded

Test #29:

score: 28
Accepted
time: 4ms
memory: 8944kb

input:

150 450 3
57 22 2 1 3
142 57 1 3 2
138 113 3 1 2
13 77 2 3 1
43 112 1 2 3
82 99 2 1 3
66 65 3 1 2
3 31 2 1 3
24 146 3 2 1
127 18 2 3 1
125 37 1 2 3
13 137 1 2 3
105 127 1 3 2
54 20 1 2 3
48 15 3 1 2
23 71 2 3 1
30 28 1 2 3
125 146 1 3 2
68 120 2 1 3
38 92 2 1 3
101 100 1 3 2
81 28 1 3 2
70 7 1 2 3
1...

output:

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

result:

ok construction is correct.

Test #30:

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

input:

150 450 3
148 73 905 1007 1204
72 13 614 952 114
72 3 1026 931 764
33 21 1143 204 536
19 112 694 1261 734
104 68 1057 72 1249
83 66 311 147 656
141 5 1349 1317 700
12 113 331 375 1165
49 7 1114 1149 1224
79 41 531 46 712
128 20 630 1175 399
35 74 421 1148 608
57 124 840 108 1238
63 22 922 403 203
35...

output:

905 614 1026 1143 694 1057 311 1349 331 1114 531 630 421 840 922 5 223 379 170 676 1154 203 1210 622 818 1258 1321 798 64 1276 696 530 767 384 52 708 1201 1088 628 1286 1067 1012 648 567 604 1184 15 1217 911 1218 894 998 535 950 308 122 1209 499 664 1145 250 666 41 1067 1342 986 732 917 1075 290 869...

result:

ok construction is correct.

Test #31:

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

input:

150 450 3
111 66 3 4 1
62 51 3 2 4
117 58 3 4 1
54 105 1 3 4
40 108 3 1 4
104 112 2 4 1
131 73 4 3 1
109 30 1 4 3
36 130 3 4 2
40 70 2 3 1
24 112 3 1 4
44 119 4 1 2
39 91 1 4 3
28 118 1 2 3
8 117 2 4 1
110 109 3 1 4
99 20 4 1 2
131 49 4 1 2
130 114 1 4 3
133 57 3 1 2
41 125 1 3 4
21 65 1 2 3
144 143...

output:

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

result:

ok construction is correct.

Test #32:

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

input:

150 450 3
79 108 4 7 3
85 72 8 3 7
105 47 5 2 8
56 47 3 4 5
66 90 7 5 3
109 68 8 1 7
84 73 5 2 3
14 7 8 5 6
129 111 5 1 2
103 45 1 6 7
102 96 7 3 2
30 80 6 1 8
22 80 5 1 6
55 21 6 3 5
4 104 6 3 8
27 130 2 1 3
64 109 7 2 4
20 110 7 8 6
5 50 5 8 2
116 8 7 8 6
5 74 3 1 6
86 124 2 4 7
129 57 2 7 8
2 9 2...

output:

4 8 5 3 7 8 5 8 5 1 7 6 5 6 6 2 7 7 5 7 3 2 2 2 7 2 2 8 8 5 4 6 6 4 8 3 5 2 4 5 3 2 3 2 5 2 5 1 4 5 7 7 3 4 3 1 7 5 3 6 2 4 8 1 6 3 1 8 6 1 4 7 5 6 2 7 2 2 1 5 3 5 6 4 2 4 1 3 1 4 5 3 1 2 5 1 6 5 2 4 6 5 2 8 2 1 5 8 8 2 8 6 2 1 5 1 4 2 7 3 2 2 1 3 5 2 8 1 3 8 8 7 7 7 1 7 2 3 4 4 8 3 2 6 1 3 7 7 1 5 ...

result:

ok construction is correct.

Test #33:

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

input:

150 350 3
69 53 1 2 3
73 148 3 1 2
29 58 3 1 2
19 84 3 1 2
8 134 3 1 2
46 147 2 3 1
115 114 2 3 1
9 13 1 2 3
27 96 1 3 2
38 75 1 3 2
127 43 2 3 1
18 100 3 1 2
134 36 3 1 2
37 14 1 3 2
33 131 2 3 1
114 17 2 1 3
86 57 2 1 3
136 12 2 3 1
7 121 3 1 2
95 51 2 1 3
84 40 1 3 2
73 47 1 3 2
116 46 2 3 1
133 ...

output:

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

result:

ok construction is correct.

Test #34:

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

input:

150 1500 10
35 119 4 6 7 8 10 3 5 9 2 1
35 5 4 1 6 7 5 8 9 3 10 2
35 18 4 1 6 9 8 2 10 7 5 3
25 90 9 10 8 1 6 4 5 3 7 2
54 132 2 3 5 4 6 9 10 8 1 7
23 122 8 3 2 6 9 10 4 7 5 1
37 108 2 9 10 7 1 6 5 4 3 8
42 45 3 1 2 4 6 9 5 8 7 10
61 54 5 10 2 1 7 6 4 8 9 3
21 10 6 2 4 3 10 1 5 8 7 9
9 68 6 3 9 5 1 ...

output:

1 4 2 8 2 9 7 7 6 6 9 10 9 2 9 2 4 5 8 2 6 10 7 5 1 4 9 3 3 2 8 3 10 9 10 7 7 6 7 2 4 5 6 7 1 9 6 10 10 1 6 6 6 5 5 4 4 4 2 6 3 7 4 1 6 7 9 2 10 2 6 4 10 6 4 10 5 6 10 2 9 10 3 1 7 2 1 2 8 4 10 9 3 9 3 3 1 9 7 5 10 5 10 9 2 2 4 3 6 9 4 3 3 1 7 7 2 9 7 2 9 4 4 7 1 10 9 6 3 1 4 2 4 6 10 6 8 5 4 10 2 2...

result:

ok construction is correct.

Test #35:

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

input:

150 1499 10
30 147 12041 480 2534 5853 460 9985 9511 2130 8477 8240
125 143 12383 3967 6251 3622 10294 1397 10212 7716 2711 6137
112 138 2728 3406 8823 707 12079 11902 11817 3859 8350 156
19 142 912 13564 8650 1043 4205 9930 2799 5040 11807 2018
4 32 10346 12401 4848 13807 13988 9904 814 4787 13290 ...

output:

12041 12383 2728 912 10346 88 8590 6632 14337 12172 8010 12832 5793 8383 13827 2979 13639 4893 3321 6620 1005 3843 6582 4208 13332 10438 5088 6199 9150 13513 5053 9256 5926 12654 12830 14553 10677 9464 4071 8319 13357 10106 6480 10526 10838 443 7704 10539 12218 8461 5527 14256 8811 10461 6065 13468 ...

result:

ok construction is correct.

Test #36:

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

input:

150 1498 10
13 93 4 3 7 9 11 10 5 1 6 8
135 4 11 6 5 1 10 3 2 8 4 9
75 91 3 9 2 8 5 4 1 6 10 11
137 110 10 9 6 2 1 11 3 4 7 8
77 76 5 6 11 3 8 4 9 1 10 7
69 51 2 9 1 4 10 8 5 3 7 11
18 27 10 6 3 11 5 4 1 2 8 7
122 101 11 3 4 2 6 10 8 9 5 1
56 2 7 9 1 10 4 3 11 8 5 2
1 16 2 5 10 8 11 1 9 6 3 4
18 54 ...

output:

4 11 3 10 3 2 10 1 1 2 4 11 3 11 1 10 2 6 7 8 6 3 8 8 11 1 2 1 7 2 10 11 2 3 2 2 5 7 2 1 10 3 9 3 10 10 9 3 1 9 3 5 6 7 9 2 2 11 8 4 8 9 8 9 4 5 3 3 1 2 9 1 9 9 3 11 5 3 6 1 5 8 11 8 1 10 6 5 10 7 4 2 4 8 10 5 2 2 10 8 4 2 8 3 5 7 5 7 6 6 1 2 11 5 5 6 6 11 11 9 9 11 3 7 8 1 4 5 11 5 7 6 5 10 6 5 4 2...

result:

ok construction is correct.

Test #37:

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

input:

150 1499 10
17 130 7 2 13 11 4 1 3 6 15 10
55 73 2 7 11 13 8 10 6 4 1 9
72 105 4 3 1 2 14 11 12 9 6 10
100 16 6 8 1 4 12 3 10 14 13 11
91 69 7 13 12 5 14 1 11 10 15 2
113 109 7 14 15 10 4 2 11 12 8 5
73 74 1 5 14 6 10 3 2 13 8 9
4 13 10 14 12 2 6 11 15 8 1 5
87 96 1 15 4 10 3 6 12 8 2 11
25 7 1 4 14...

output:

7 2 4 6 7 7 1 2 1 1 9 9 12 1 13 13 13 13 2 7 7 6 7 1 6 9 6 3 13 5 8 10 9 13 9 14 12 15 1 2 12 5 15 14 14 13 1 6 3 8 1 2 1 15 14 9 5 15 12 14 6 11 4 12 10 7 15 10 7 2 5 1 12 13 13 2 15 15 8 3 12 12 14 5 5 2 10 4 1 8 3 2 7 11 3 12 7 15 4 11 14 7 15 2 14 7 6 15 12 6 2 6 3 9 14 1 3 1 3 15 14 1 13 6 11 1...

result:

ok construction is correct.

Test #38:

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

input:

150 1400 10
101 73 1 7 5 3 10 6 2 8 4 9
100 14 6 4 8 5 9 2 10 7 1 3
89 103 3 2 5 7 1 9 4 8 6 10
31 63 5 10 6 7 9 4 2 8 1 3
81 145 6 7 5 2 9 4 10 8 1 3
103 95 4 8 3 5 2 9 10 1 7 6
14 89 1 9 2 4 10 8 5 3 6 7
90 111 7 10 8 5 4 6 3 1 9 2
82 11 10 7 1 3 9 2 8 6 5 4
5 119 6 9 7 4 10 5 8 1 3 2
147 74 9 2 6...

output:

1 1 3 8 2 4 9 7 9 6 9 3 7 2 5 10 1 1 5 4 6 5 7 2 9 8 3 2 3 1 10 5 3 7 3 5 8 10 10 10 1 10 5 5 6 5 5 3 3 1 4 8 9 9 9 3 10 1 9 2 9 1 1 6 7 9 9 3 1 2 10 5 6 5 6 3 8 8 1 3 3 4 10 8 7 8 2 7 9 3 9 3 10 6 9 1 6 6 3 7 6 4 10 6 1 8 8 9 1 3 8 9 7 10 4 5 1 4 6 5 9 3 7 5 7 7 10 8 2 1 7 2 5 4 4 7 2 9 8 2 1 6 2 4...

result:

ok construction is correct.

Test #39:

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

input:

150 3000 20
130 71 11 13 17 10 15 2 4 18 3 5 1 7 14 8 9 12 6 20 19 16
93 110 17 11 20 2 1 19 7 9 14 16 4 5 12 10 15 18 8 13 3 6
3 80 1 12 8 3 19 17 6 5 2 15 14 16 11 20 7 18 10 9 4 13
118 56 14 1 16 13 11 20 3 17 18 5 9 10 19 8 7 12 2 4 6 15
87 14 4 19 8 1 7 13 15 18 11 2 14 16 9 20 3 12 6 5 17 10
1...

output:

18 17 7 14 11 8 15 10 9 19 20 6 5 7 11 3 19 16 7 5 6 16 14 17 11 16 11 8 5 1 16 12 17 7 10 20 11 12 1 14 13 7 3 20 12 9 18 8 11 11 2 12 14 7 2 11 18 4 1 2 4 1 19 15 16 5 18 13 20 3 1 2 19 6 19 10 13 4 3 19 3 16 14 14 7 2 1 6 18 9 10 6 8 4 9 8 17 5 17 7 10 14 4 11 2 3 15 17 11 6 11 11 10 13 3 11 13 1...

result:

ok construction is correct.

Test #40:

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

input:

150 2997 20
137 131 5762 9111 38967 15773 52237 2826 21697 38030 50735 19494 3273 2767 35083 37295 10180 21810 12236 12874 15065 37851
29 78 50409 52886 11932 43949 7925 40147 2771 49165 639 12786 39123 36098 18441 22546 59053 36310 28727 8858 36938 4917
31 45 14688 22548 41715 42035 1729 54934 3718...

output:

5762 50409 14688 43023 2446 31055 34035 9556 52476 10587 54852 3757 13688 26892 40621 54728 3902 58380 54511 17233 30462 27258 10951 48397 36997 6151 49936 56467 59187 53097 11044 48465 23223 58290 18037 39297 36801 9769 50514 57662 16214 8256 10360 25264 56418 46945 53694 17298 5176 7520 38428 5958...

result:

ok construction is correct.

Test #41:

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

input:

150 2998 20
57 43 1 2 17 16 7 9 11 15 6 3 12 20 10 21 5 14 4 13 18 19
70 32 13 15 17 8 19 3 6 5 1 18 16 7 21 4 9 14 12 10 20 11
119 97 2 13 19 4 21 11 8 15 9 16 1 3 10 14 12 17 7 5 6 18
31 74 12 13 20 19 18 11 6 4 10 1 9 8 3 7 2 17 5 14 21 16
40 144 15 3 6 17 9 5 13 21 18 12 14 11 20 7 10 1 19 16 2 ...

output:

10 13 2 13 15 5 6 9 6 10 2 1 1 3 10 4 5 17 15 20 17 17 13 11 16 16 12 18 9 12 18 4 15 11 18 9 10 7 20 19 2 15 8 7 15 10 9 1 15 10 11 14 19 1 9 14 1 11 20 16 6 18 6 5 18 21 21 16 6 5 21 1 5 11 13 15 1 20 20 7 14 2 8 21 2 2 17 17 5 10 11 11 11 2 16 5 8 6 14 8 13 21 2 6 9 12 10 14 10 2 4 20 10 3 15 3 1...

result:

ok construction is correct.

Test #42:

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

input:

150 2997 20
63 21 8 6 4 1 19 14 10 16 18 24 2 21 5 3 15 17 7 9 23 12
40 101 12 24 13 18 10 21 22 19 16 15 14 1 23 8 4 2 25 5 7 20
32 150 18 24 16 13 3 22 23 9 20 8 12 14 15 1 25 5 2 6 11 21
122 137 25 7 11 8 5 24 10 22 18 15 9 20 4 16 13 12 17 3 19 6
72 105 12 13 4 21 10 17 24 20 25 9 18 8 14 5 16 1...

output:

8 12 18 25 12 10 4 1 10 18 8 9 9 8 6 1 16 23 1 19 3 11 20 14 19 8 13 2 4 4 10 3 25 18 20 17 20 18 12 20 23 10 2 5 14 20 7 2 24 10 10 17 19 11 9 4 10 19 19 4 15 12 5 22 17 2 1 22 6 17 25 17 15 11 1 6 9 20 11 11 5 13 18 25 7 14 13 23 7 11 3 12 16 6 16 12 5 9 6 9 23 9 5 17 9 9 2 6 23 1 20 24 18 19 24 1...

result:

ok construction is correct.

Test #43:

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

input:

150 2900 20
84 108 9 13 4 12 20 6 7 2 11 15 14 1 17 8 16 18 19 3 10 5
24 23 6 13 2 8 20 17 1 4 3 19 12 7 11 16 14 9 5 10 15 18
141 53 11 8 2 13 19 1 12 9 18 4 6 3 14 16 17 15 20 5 10 7
37 109 8 7 2 18 4 17 12 6 16 20 19 13 11 1 10 14 5 3 15 9
88 3 4 20 3 1 15 2 18 7 11 17 9 19 10 12 13 14 6 16 5 8
3...

output:

9 6 8 8 3 5 12 7 12 12 3 8 2 2 17 18 10 11 4 17 16 4 16 7 2 8 3 9 17 5 13 19 3 10 13 19 14 20 14 17 10 14 11 4 6 20 9 16 20 20 14 9 13 7 8 2 14 4 13 5 15 4 11 8 17 20 5 12 16 7 18 13 5 9 15 1 14 19 1 4 11 2 8 17 18 18 12 20 1 13 7 14 6 8 2 18 20 11 6 19 20 7 16 1 10 9 8 6 18 3 12 12 2 20 14 15 9 8 2...

result:

ok construction is correct.

Test #44:

score: 0
Accepted
time: 26ms
memory: 11192kb

input:

150 7494 50
57 77 43 20 29 31 16 40 17 1 37 48 24 33 15 22 23 38 41 7 3 42 11 12 45 5 27 36 8 25 26 34 2 10 19 21 46 6 50 39 44 13 32 4 14 35 47 18 49 9 30 28
7 123 33 10 24 45 26 3 40 11 6 27 29 35 32 17 20 13 8 31 9 37 38 7 1 5 16 43 12 4 28 30 14 36 25 48 49 2 34 41 47 39 21 42 44 19 50 46 18 22 ...

output:

43 9 32 27 38 2 48 4 38 13 31 50 50 31 35 32 35 28 35 18 8 6 34 49 14 26 32 21 16 50 21 31 7 10 25 34 40 25 8 40 21 44 38 6 28 41 26 25 38 39 33 24 41 44 21 20 12 1 38 50 18 30 20 15 36 37 33 19 42 34 16 24 19 18 49 50 11 39 46 14 1 49 48 6 8 44 45 13 37 34 1 23 20 36 22 17 30 14 42 36 45 44 28 22 5...

result:

ok construction is correct.

Test #45:

score: 0
Accepted
time: 17ms
memory: 11100kb

input:

150 7483 50
30 40 19 50 18 29 7 53 30 22 1 31 25 20 43 23 55 16 40 42 9 15 3 33 10 35 41 51 44 32 46 21 49 39 34 48 13 28 45 36 24 8 52 47 37 12 4 26 27 11 38 2
7 59 46 18 6 9 52 19 35 21 24 28 39 54 14 16 11 20 41 23 17 7 5 31 8 29 51 25 33 53 4 22 15 37 48 44 32 2 30 47 13 49 10 3 43 34 42 45 12 1...

output:

19 46 38 32 26 50 33 1 3 20 30 9 49 8 29 44 41 30 51 22 7 29 55 50 23 47 16 54 41 11 30 53 30 1 27 1 30 50 49 6 15 5 23 6 23 31 49 52 48 50 35 6 45 43 46 47 24 4 53 15 6 46 37 14 5 55 52 34 27 13 2 23 35 14 39 27 7 28 44 49 51 41 54 32 35 8 8 30 7 1 20 42 10 12 43 22 37 14 54 52 24 18 25 48 47 39 24...

result:

ok construction is correct.

Test #46:

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

input:

150 14979 100
51 51 23 8 1 82 39 77 42 18 99 74 78 60 49 86 100 63 59 12 52 87 14 83 48 33 5 50 67 34 94 75 28 38 24 70 51 97 7 35 30 55 80 66 10 37 11 41 25 89 68 17 95 56 84 92 90 85 6 81 96 62 57 27 2 20 69 15 4 53 36 16 40 71 45 22 93 88 46 79 58 3 91 64 32 9 21 73 76 29 26 54 65 44 13 72 19 47 ...

output:

23 63 74 91 36 65 97 27 15 71 28 86 96 44 26 31 75 42 22 71 95 33 90 67 73 93 86 51 46 37 64 76 54 14 14 53 5 94 12 39 56 50 80 7 42 54 62 76 12 63 10 43 79 59 57 35 68 52 72 42 2 33 31 56 36 55 82 67 17 88 76 32 10 92 79 8 10 25 32 1 72 11 29 30 17 89 97 50 32 60 14 2 33 95 17 93 78 23 69 74 62 64 ...

result:

ok construction is correct.

Test #47:

score: 0
Accepted
time: 54ms
memory: 17124kb

input:

150 14976 100
49 146 50 24 101 73 47 94 6 79 38 8 75 64 36 89 15 29 97 23 56 98 74 17 44 3 7 58 65 49 14 105 21 52 95 12 59 28 10 27 2 69 32 11 91 80 26 87 82 40 48 4 35 100 53 88 5 41 55 72 66 42 22 9 63 85 76 68 77 84 70 45 30 39 57 46 51 60 86 93 61 25 13 19 18 103 96 62 20 99 83 92 33 67 90 54 7...

output:

50 76 85 33 96 19 14 92 27 93 96 84 19 97 15 86 28 38 22 86 64 84 20 20 75 50 69 3 50 44 99 85 85 43 94 87 14 103 18 84 51 84 100 44 9 5 86 51 93 32 78 52 68 4 67 53 68 73 50 66 55 94 66 39 22 53 52 47 39 68 78 30 4 26 93 12 34 18 67 11 51 44 52 51 58 59 2 72 38 33 53 65 48 4 6 26 33 80 100 49 42 88...

result:

ok construction is correct.

Test #48:

score: -28
Time Limit Exceeded

input:

150 20969 140
12 46 41 108 67 140 21 20 11 126 62 100 117 5 76 64 49 60 3 58 55 19 133 85 98 10 18 63 26 122 39 96 115 69 34 53 24 110 45 112 61 120 71 82 129 92 131 16 105 43 138 74 31 95 130 102 17 81 14 70 77 12 32 38 23 124 79 40 86 90 101 123 59 78 94 2 30 118 13 33 65 121 56 116 80 127 44 128 ...

output:


result: