QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#522621#8906. Улитка на склонеDaiRuiChen007100 ✓49ms10992kbC++17547b2024-08-17 09:09:472024-08-17 09:09:48

Judging History

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

  • [2024-08-17 09:09:48]
  • 评测
  • 测评结果:100
  • 用时:49ms
  • 内存:10992kb
  • [2024-08-17 09:09:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;
int n,k,q,ch[MAXN][2],sum[MAXN];
void dfs(int u,int d,int w) {
	if(!ch[u][0]) return sum[u]=(w<=k),void();
	for(int i:{0,1}) {
		dfs(ch[u][i],i,w+(d^i)),sum[u]+=sum[ch[u][i]];
	}
}
signed main() {
	scanf("%d%d%d",&n,&k,&q);
	for(int i=1,op;i<=n;++i) {
		scanf("%d",&op);
		if(op==2) scanf("%d%d",&ch[i][0],&ch[i][1]);
	}
	dfs(ch[1][0],0,0),dfs(ch[1][1],1,0),sum[1]=sum[ch[1][0]]+sum[ch[1][1]];
	for(int u;q--;) scanf("%d",&u),printf("%d\n",sum[u]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 1ms
memory: 3932kb

input:

499 50 500
2 120 392
2 179 29
2 112 298
2 451 46
2 293 480
0
2 125 243
2 111 75
2 87 259
0
0
0
2 463 70
0
2 415 17
2 313 170
2 261 3
2 343 499
0
2 399 424
2 436 262
2 297 103
2 230 497
2 439 60
0
2 86 315
0
2 142 355
0
2 81 178
0
0
2 358 115
2 496 299
0
0
0
2 377 292
2 93 379
0
0
0
0
0
2 34 176
2 33...

output:

1
0
1
0
0
1
0
0
1
1
1
1
0
1
0
1
0
0
0
1
0
0
1
1
1
1
1
0
1
0
0
0
1
1
0
0
0
1
0
0
0
0
1
0
0
1
0
0
1
0
1
1
1
1
1
1
1
0
1
1
0
0
0
1
0
0
0
0
1
0
0
1
1
0
1
1
0
1
1
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
1
0
1
1
0
0
1
0
0
1
0
1
1
0
1
1
1
1
0
1
0
1
0
1
1
0
0
0
0
0
0
0
1
0
0
...

result:

ok 500 numbers

Test #2:

score: 11
Accepted
time: 1ms
memory: 5856kb

input:

499 0 499
2 266 298
2 31 60
2 247 281
0
0
2 335 376
2 382 238
2 263 430
2 21 196
0
2 83 482
0
0
0
2 191 420
2 485 2
2 160 9
0
0
0
0
2 97 431
2 90 426
0
0
2 279 299
0
2 158 340
2 25 268
2 356 188
0
0
0
2 199 69
0
0
2 394 416
0
2 463 120
0
0
0
0
0
0
0
0
2 489 139
2 103 190
2 293 3
2 211 228
2 366 125
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 499 numbers

Test #3:

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

input:

499 51 500
2 263 365
0
0
0
2 303 487
2 181 424
2 226 119
0
0
0
0
0
2 190 285
2 325 225
0
0
2 154 447
0
2 118 145
2 55 144
0
0
0
0
2 70 361
2 24 320
0
0
2 421 371
2 4 266
2 302 491
2 95 443
2 174 195
0
0
0
2 484 296
2 22 400
0
0
2 21 6
2 319 404
0
0
0
2 370 235
0
2 334 449
0
0
0
0
0
2 305 333
0
2 470...

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 500 numbers

Test #4:

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

input:

497 6 498
2 448 487
2 145 309
0
0
0
0
2 178 77
0
0
0
2 200 410
2 76 392
0
0
0
2 493 156
0
0
0
0
2 22 2
0
0
2 381 202
2 303 41
2 377 163
0
0
0
2 339 218
2 15 16
2 373 404
2 59 209
2 135 431
2 5 63
0
2 270 461
2 374 233
2 9 361
2 396 346
0
0
2 121 453
0
0
2 100 45
2 60 189
2 82 263
0
2 193 136
2 274 2...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 498 numbers

Test #5:

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

input:

499 175 500
2 277 88
0
2 296 262
0
0
2 431 84
0
2 230 468
0
0
0
2 294 484
0
0
0
2 71 20
0
2 226 145
2 304 339
0
2 193 120
2 227 36
0
0
0
2 75 219
0
2 418 309
2 161 477
2 115 402
2 249 475
2 452 285
0
0
2 256 257
2 463 221
0
2 87 128
0
0
0
0
2 401 53
2 165 101
2 432 147
2 312 65
0
2 324 129
0
2 367 3...

output:

1
1
0
1
1
1
1
1
1
0
1
1
0
1
1
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
0
0
1
1
1
1
0
0
0
1
0
1
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
0
1
1
1
0
1
1
0
0
0
1
1
0
1
0
0
1
0
1
1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
1
0
0
...

result:

ok 500 numbers

Test #6:

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

input:

499 245 500
2 322 116
0
2 460 412
0
2 115 2
0
0
0
2 84 211
2 222 25
0
0
2 65 344
0
2 247 252
2 73 192
2 94 440
2 277 455
0
2 237 77
2 149 362
2 103 319
2 66 133
0
2 418 293
2 309 451
0
2 416 5
2 352 472
2 33 38
2 187 156
0
0
2 402 329
0
0
2 399 373
2 359 165
0
2 164 376
2 221 128
0
0
0
2 336 268
2 2...

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
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500 numbers

Test #7:

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

input:

499 75 499
2 101 271
2 423 424
0
0
2 157 34
0
2 253 479
2 482 114
2 136 135
2 176 146
2 452 248
0
0
2 470 425
0
2 391 329
2 196 52
2 362 208
0
0
0
2 397 430
2 201 39
2 468 37
0
2 392 435
2 60 463
0
2 2 396
2 367 182
0
0
0
2 20 354
0
0
2 28 89
2 8 273
0
2 246 442
2 235 360
0
2 58 277
0
0
2 345 97
0
0...

output:

0
0
1
1
0
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
0
1
1
0
1
1
1
1
0
1
1
1
0
0
0
1
1
0
0
0
0
0
1
0
1
0
0
1
0
1
0
0
1
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
1
0
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
0
1
0
0
1
0
0
1
1
0
1
0
1
1
1
1
0
...

result:

ok 499 numbers

Subtask #2:

score: 12
Accepted

Dependency #1:

100%
Accepted

Test #8:

score: 12
Accepted
time: 0ms
memory: 3944kb

input:

499 50 500
2 52 132
0
2 384 336
0
2 421 85
2 420 355
2 163 486
2 126 45
0
0
0
2 345 59
2 55 340
2 127 128
2 187 339
0
0
2 256 89
2 422 295
0
0
2 494 46
0
0
2 305 459
0
0
0
2 109 438
2 168 83
0
2 265 221
2 414 464
0
2 19 236
0
2 358 474
0
2 23 476
0
2 206 404
0
0
2 42 251
2 153 74
2 373 41
0
0
0
2 19...

output:

0
1
0
0
1
1
1
0
1
1
102
0
0
51
0
76
1
0
0
77
142
133
78
56
107
2
86
5
0
1
1
1
2
74
0
0
0
2
36
1
0
121
25
0
0
1
105
0
1
0
0
88
1
0
0
0
0
0
123
1
0
1
0
11
0
1
0
0
0
89
0
0
0
1
141
0
39
30
0
1
1
1
73
0
143
1
0
124
0
1
1
66
0
84
1
1
0
1
2
60
0
1
75
2
1
1
1
0
0
19
68
45
0
0
1
0
1
1
0
0
1
1
0
1
0
2
1
0
0
...

result:

ok 500 numbers

Test #9:

score: 12
Accepted
time: 0ms
memory: 3928kb

input:

499 0 499
2 326 313
2 189 139
0
2 303 445
0
0
2 437 349
0
2 40 302
2 312 36
0
0
2 20 284
2 354 429
0
0
2 287 319
2 451 190
0
0
0
0
0
2 164 496
0
2 203 113
0
0
2 421 331
2 245 316
0
2 384 497
2 337 78
2 281 7
0
2 465 481
2 46 344
0
0
0
2 476 137
0
2 340 87
0
0
0
2 3 10
2 56 47
0
0
0
0
0
0
0
0
2 278 2...

output:

1
1
0
1
1
0
1
1
0
1
0
1
1
0
1
0
1
1
1
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
0
0
1
1
0
0
1
1
1
1
1
0
1
0
0
0
1
1
1
0
0
1
0
1
0
0
1
0
0
0
1
0
1
1
0
1
1
1
0
0
1
0
1
1
0
0
0
0
0
1
0
1
1
0
0
0
1
0
1
1
0
0
1
0
1
0
1
1
0
1
0
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
1
0
0
1
0
1
0
...

result:

ok 499 numbers

Test #10:

score: 12
Accepted
time: 0ms
memory: 3984kb

input:

499 51 500
2 305 355
2 125 60
2 279 372
2 467 101
2 73 65
0
2 110 119
2 389 5
2 378 192
0
2 476 152
0
2 24 91
2 317 442
2 10 424
0
0
2 243 262
0
2 335 85
0
2 63 441
0
0
0
0
2 78 437
2 284 136
0
2 283 435
2 444 178
2 168 329
0
2 228 450
0
0
2 470 28
2 453 488
0
2 390 260
2 207 404
2 117 472
0
0
2 439...

output:

1
1
87
1
203
222
1
1
1
1
241
235
1
141
1
162
4
1
182
189
1
1
1
1
1
1
146
88
1
1
1
171
157
1
1
44
1
1
224
37
132
1
245
1
154
1
1
1
207
247
192
48
116
1
1
180
1
1
209
1
1
106
175
75
204
144
1
124
62
61
20
1
1
1
191
97
1
1
145
1
246
202
1
70
1
1
1
249
1
1
1
102
1
1
6
1
134
17
1
60
112
244
1
228
166
1
1...

result:

ok 500 numbers

Test #11:

score: 12
Accepted
time: 0ms
memory: 4000kb

input:

499 6 498
2 111 64
0
0
2 433 360
0
2 268 249
0
2 17 203
0
2 395 104
2 162 303
0
2 191 344
0
2 319 347
0
2 145 272
0
2 107 3
2 58 216
0
0
0
2 206 410
0
0
0
2 302 72
2 238 181
0
2 414 371
0
2 441 260
0
2 12 125
0
0
0
2 196 363
0
0
0
0
2 421 179
2 156 117
2 346 470
2 131 280
2 251 339
2 284 175
0
2 445...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
4
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 498 numbers

Test #12:

score: 12
Accepted
time: 0ms
memory: 5988kb

input:

499 175 500
2 207 106
2 254 334
2 94 422
2 108 464
0
2 350 344
0
2 424 271
0
2 174 259
2 58 484
2 208 481
0
2 125 22
0
0
2 305 275
0
0
0
0
0
0
0
2 315 249
0
2 232 342
2 439 443
0
2 273 494
2 175 331
0
0
2 91 308
2 302 165
0
2 122 179
0
0
2 371 280
2 266 488
0
2 6 187
2 346 135
0
0
0
0
0
0
0
2 186 28...

output:

1
100
1
1
1
1
161
1
0
77
1
32
91
1
24
1
177
0
0
1
1
1
1
1
0
7
0
0
1
0
1
1
0
92
53
1
0
1
173
0
150
1
1
0
0
1
0
1
1
1
1
1
62
0
70
31
151
34
0
1
1
1
51
81
1
1
1
165
118
99
1
1
57
162
1
0
1
0
1
0
1
0
1
0
0
1
55
1
1
0
1
48
19
0
73
1
0
0
1
1
0
0
0
1
1
1
1
0
0
22
119
1
0
1
170
6
1
0
89
1
0
169
35
1
1
155
3...

result:

ok 500 numbers

Test #13:

score: 12
Accepted
time: 0ms
memory: 3944kb

input:

499 245 500
2 442 17
0
2 6 225
2 209 426
2 472 381
0
2 323 64
2 354 300
2 77 320
2 459 338
0
0
0
0
0
2 479 165
2 227 415
0
2 347 194
2 241 445
2 140 385
0
0
2 22 230
0
2 200 75
0
2 461 42
0
2 243 67
2 174 201
0
2 197 145
0
0
0
0
2 89 221
0
2 242 61
2 56 448
0
2 388 260
0
0
0
0
2 409 228
2 423 76
2 1...

output:

149
1
66
1
5
1
30
1
46
221
1
1
160
1
1
103
177
1
1
1
15
213
95
243
1
1
244
9
247
114
199
245
1
100
90
1
187
136
1
1
1
148
11
1
139
1
197
53
1
115
1
1
1
91
1
1
1
1
38
70
24
1
188
27
1
1
1
1
1
1
1
89
1
172
1
1
196
119
22
92
195
179
1
109
1
1
1
50
13
1
178
1
25
1
1
1
190
1
14
1
55
189
69
88
127
31
42
1...

result:

ok 500 numbers

Test #14:

score: 12
Accepted
time: 0ms
memory: 3856kb

input:

499 75 499
2 76 166
0
2 22 37
0
2 64 140
2 74 244
0
0
0
0
2 440 287
2 28 372
0
0
2 321 203
0
2 494 224
2 459 447
0
2 57 383
2 23 156
2 215 358
0
2 3 187
2 185 445
2 414 380
2 336 232
0
2 451 50
2 371 113
2 455 466
2 171 91
2 476 387
2 418 195
2 267 147
2 170 416
0
0
0
2 131 325
2 323 164
2 378 247
0...

output:

149
0
0
154
48
23
1
148
72
103
167
0
1
0
29
64
1
46
41
1
1
1
95
1
1
93
1
1
132
1
1
0
126
1
0
0
1
73
0
79
1
1
146
1
1
65
1
8
0
1
104
76
1
0
131
153
0
16
101
0
0
1
102
166
7
116
0
0
71
32
140
1
1
0
0
58
1
10
14
107
0
80
1
1
22
0
0
0
0
0
0
165
1
0
38
1
11
0
0
0
159
120
1
0
1
1
0
1
1
0
0
28
0
0
0
0
136
...

result:

ok 499 numbers

Subtask #3:

score: 10
Accepted

Test #15:

score: 10
Accepted
time: 45ms
memory: 10092kb

input:

199997 199997 200000
2 91863 70898
0
2 105418 170774
0
0
0
2 26531 124458
2 196046 184600
2 76105 122785
2 97286 129974
0
2 45502 23580
0
2 1661 18577
0
0
0
0
2 176099 57422
0
0
2 110842 183169
2 185713 9521
0
2 152668 108628
0
0
2 80913 138901
0
2 182265 183931
0
2 185477 166182
2 194690 87453
0
2 ...

output:

14687
90631
2
1
1
1
57266
1
9399
1
1
59100
10137
23928
67504
65267
1
1
1
33901
1
1
52794
1
1
1
71950
71909
1
3
24162
26342
66980
1
1
1
1
82085
1
1
1
2
57003
1
1
86132
1
96630
2
96394
1
1
46671
48050
88111
1
83767
67475
41508
1
99004
98532
8359
39798
1
1
1
57234
49629
1
1
1
28453
2
1
1
1
28122
2
2
1
...

result:

ok 200000 numbers

Test #16:

score: 10
Accepted
time: 47ms
memory: 10992kb

input:

199999 199999 199998
2 139197 67532
2 42806 69222
0
2 96337 137950
2 153720 184800
0
2 162164 170380
2 143252 16193
2 23724 149322
2 95322 53985
0
0
0
0
2 58337 158789
2 64009 1471
2 133363 139287
0
2 25864 25512
2 194688 99684
2 112806 8857
0
0
2 102126 141386
0
0
0
2 155289 142134
0
2 16949 179721...

output:

52509
1
28969
48595
15034
1
1
1
29443
1
72983
1
1
74522
31870
1
95024
1
1
8478
1
1
1
1
88030
69285
1
1
1
60810
1
1
1
1
18861
4893
1
94134
1
54796
59646
49109
56668
1
85308
76314
1
1
10793
80559
51614
1
86514
12383
50231
58215
1
59077
1
1
1
19987
87243
1
54379
1
1
44641
1
1
25615
12368
57991
78060
1
...

result:

ok 199998 numbers

Test #17:

score: 10
Accepted
time: 43ms
memory: 10932kb

input:

199999 199999 200000
2 115265 78900
0
0
0
2 92907 86749
2 148173 83602
0
2 59629 23581
2 121753 169949
2 192934 7557
2 122190 6401
0
2 172499 19161
2 101541 119463
2 41026 128024
2 113270 78406
0
2 47623 112657
0
0
0
0
0
2 37253 181508
2 193378 118864
0
0
2 109284 192339
0
0
0
2 58806 128087
0
0
0
2...

output:

1
1
1
1
1
55869
4603
1
65210
1
99444
1
1
3954
1
68232
75142
1
22993
8739
30337
1
1
1
33150
20360
65729
19514
1
59032
1
1
26301
85225
1
1
41574
63571
30584
64209
90679
1
1
1
1
83260
94843
42529
1
94372
42402
52699
1
92828
44160
1
1
93226
1
82657
1
90306
1
1
49369
1
89759
1
92612
1
38033
1
1
48936
620...

result:

ok 200000 numbers

Test #18:

score: 10
Accepted
time: 49ms
memory: 10980kb

input:

199999 199999 200000
2 20877 37198
2 15619 188324
2 94233 35211
2 160591 12595
0
0
2 167158 34883
2 91835 61120
0
0
0
0
2 14267 111802
0
0
0
2 143288 97251
2 77438 101951
0
0
0
0
0
0
0
2 194525 172660
2 83689 31537
2 194221 102019
2 146691 69425
0
0
0
0
0
0
2 197221 89292
0
2 162376 199985
0
0
2 245...

output:

24137
1
73202
1
1
18855
1
1
1
98321
26602
23792
32410
88590
1
1
98646
1
1
1
1
1
13944
37763
1
1
1
1
1
1
1
76090
1
1
35261
1
39968
1
1
1
1
6041
1
62807
1
42642
81867
51465
1
1
13902
16950
67593
84737
32852
15889
1
22825
47177
62141
93794
1
1
1
15260
1
66712
44778
98000
1
422
56923
1
7151
19904
1
1
89...

result:

ok 200000 numbers

Subtask #4:

score: 14
Accepted

Test #19:

score: 14
Accepted
time: 47ms
memory: 10172kb

input:

199997 0 199999
2 22169 117671
2 23882 141690
2 37211 148845
0
2 193927 125917
2 196104 27207
2 183535 186777
2 50455 5522
0
0
0
0
2 43783 24750
0
0
2 155272 155342
0
0
0
2 41355 62574
2 134751 65065
0
2 193788 149095
2 106585 99097
2 97728 95397
2 15370 191073
2 37182 45315
2 75236 44523
2 166052 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 199999 numbers

Test #20:

score: 14
Accepted
time: 47ms
memory: 10868kb

input:

199999 0 200000
2 192166 37195
2 78392 171460
0
0
2 114508 146885
2 163228 62760
2 193185 55636
2 94755 197145
2 149185 66804
0
2 84684 5937
2 145684 65985
0
0
0
2 10406 118513
0
2 75960 197931
2 51945 96206
2 102950 98548
0
2 28848 40225
2 171915 42999
2 95398 135117
0
2 4396 629
0
2 166722 182198
...

output:

0
1
0
1
0
0
0
1
1
0
1
0
0
1
0
1
0
1
0
1
0
0
0
0
1
0
0
1
1
1
0
1
1
1
0
0
0
0
1
0
1
1
0
1
0
1
0
0
0
0
1
0
0
1
1
1
0
0
1
1
1
0
0
0
0
0
1
0
0
0
0
0
1
1
1
1
0
1
0
1
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
0
1
0
1
1
0
1
1
1
0
1
1
0
1
1
0
1
0
0
1
0
0
1
0
1
1
0
0
1
0
0
1
0
1
1
1
0
1
1
0
0
0
0
0
0
1
1
...

result:

ok 200000 numbers

Test #21:

score: 14
Accepted
time: 47ms
memory: 10952kb

input:

199997 0 199998
2 44402 168015
2 146752 41954
2 100206 52670
0
2 8253 138975
2 72772 145953
0
0
2 27998 126071
2 28279 54387
0
0
0
2 86183 148215
2 193130 16872
2 158505 148595
0
2 59417 75663
2 120889 135541
0
0
0
0
0
2 41578 111647
0
2 172343 120434
2 45230 24509
2 170297 96991
2 34113 50161
0
2 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 199998 numbers

Test #22:

score: 14
Accepted
time: 43ms
memory: 10924kb

input:

199999 0 200000
2 125371 8214
2 5270 48370
0
0
2 35807 153590
0
2 97872 148329
0
0
0
2 156571 58040
0
2 649 15222
2 139327 23175
2 167211 148169
0
0
0
2 82012 71403
0
2 152680 162021
2 46893 30121
2 147039 9075
0
2 32602 168202
0
2 113503 13760
0
0
0
2 19479 190578
0
0
2 198966 171401
2 82494 134342...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 200000 numbers

Subtask #5:

score: 19
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 19
Accepted
time: 37ms
memory: 10036kb

input:

199999 27000 199999
2 104604 157424
2 36620 136837
2 196294 112003
0
0
0
0
0
2 26812 90369
2 101746 36783
0
0
2 123046 164136
0
0
2 47439 83275
0
2 70294 178106
2 66970 54362
2 88839 85891
2 162750 16195
0
0
0
0
0
2 103710 118003
0
2 182270 84652
2 76626 157919
2 171127 7384
0
2 17261 101467
0
0
0
2...

output:

1
1
1
0
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
1
0
1
1
1
0
0
1
0
0
0
1
1
0
1
1
1
1
0
1
1
0
1
0
1
1
0
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
0
0
0
0
1
1
1
1
1
1
1
0
1
0
1
1
1
...

result:

ok 199999 numbers

Test #24:

score: 19
Accepted
time: 42ms
memory: 10892kb

input:

199999 1 200000
2 14183 98692
0
0
2 114029 146282
2 25445 153564
2 195580 17417
2 32916 83516
0
0
2 175064 37516
2 126227 105603
0
2 133197 159236
2 144619 136049
0
2 156468 171718
0
0
0
0
0
2 101720 173322
0
0
0
0
2 162428 148669
0
0
2 7542 164822
0
0
0
2 184009 171865
0
0
0
0
2 44140 163976
2 2254...

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 200000 numbers

Test #25:

score: 19
Accepted
time: 39ms
memory: 10812kb

input:

199997 80000 200000
2 121850 93680
2 32876 185738
0
0
2 192402 105424
0
0
2 161494 24343
2 109398 36791
0
0
2 183769 115006
2 116153 197440
2 63388 29862
2 109228 77440
0
2 124478 110094
2 90651 181719
2 104334 170841
2 137698 78389
0
0
2 34315 188708
0
0
2 96399 50305
0
2 23091 90209
0
0
0
2 166444...

output:

1
1
1
1
0
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
0
0
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
1
0
1
0
1
1
0
1
1
1
0
0
1
1
0
1
1
0
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
0
0
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
...

result:

ok 200000 numbers

Test #26:

score: 19
Accepted
time: 49ms
memory: 10940kb

input:

199999 40000 199999
2 195059 131237
2 188854 75326
0
2 72960 82419
2 111404 168801
0
0
0
0
2 52011 114659
0
2 148825 14543
2 89340 155510
0
0
0
0
0
2 55914 126661
0
0
0
0
0
0
0
0
2 123998 79500
2 25108 84617
0
0
2 190288 98969
2 15297 23550
0
2 76738 50618
0
0
2 10076 111569
0
2 179470 49792
0
2 185...

output:

1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
...

result:

ok 199999 numbers

Subtask #6:

score: 34
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #27:

score: 34
Accepted
time: 44ms
memory: 10180kb

input:

199999 28000 200000
2 106736 157365
0
0
0
0
2 134867 74492
0
0
2 78844 119781
2 140224 176502
2 104116 161211
0
0
2 179627 86348
2 122290 80744
2 47642 163919
2 188525 179967
2 158446 87813
0
2 6399 172025
2 30486 2474
2 61142 158491
2 150712 118406
2 23222 182912
2 50063 153805
2 169766 117909
2 17...

output:

0
0
1
0
0
1
676
21722
0
0
1
1
32799
2
0
0
1
1
0
1
0
1
4
1034
0
57933
31151
7
51543
0
1
0
66147
1
39469
4
41063
52598
1
14519
0
1
1
1
0
0
48895
27936
1
3
5162
1
21824
0
1
1
1
5842
0
0
0
0
0
0
2
21258
1
1
1
65874
0
43646
1
40397
52582
1
1
26216
0
50290
18886
1
1
0
1
0
37346
1
1
32674
1
0
53210
16489
1...

result:

ok 200000 numbers

Test #28:

score: 34
Accepted
time: 39ms
memory: 10892kb

input:

199997 1 199999
2 198866 71722
2 47451 38182
2 54834 176675
2 142829 162172
2 66011 176196
2 115091 131447
2 105987 9934
0
2 102131 77491
0
2 199851 138672
0
2 147923 140915
0
0
2 183475 136462
0
0
0
2 75779 87802
0
0
0
2 100447 159026
0
2 100170 89461
2 191160 20032
2 2500 137316
0
2 14935 103223
0...

output:

1
1
1810
1
91043
6708
16214
97671
87859
60984
91039
1
1
1
1
5434
1
1
1
55286
63156
1
17756
1
1
1
53400
1
12057
1
1
6400
31308
90456
93551
63065
1
1
50545
1
76863
14328
64619
69567
88748
1
3208
1
1
28610
1
56661
23375
1
38714
1
1
1
1
65598
1
905
1
29114
1
1
78205
45260
1
1
4416
77341
1
1
11112
28048
...

result:

ok 199999 numbers

Test #29:

score: 34
Accepted
time: 35ms
memory: 10812kb

input:

199999 100 200000
2 39103 96850
2 56613 11569
2 112984 61248
2 126452 134373
2 7950 180621
2 141998 176393
0
2 183416 149665
0
2 173520 62880
0
2 173899 139374
0
0
0
0
2 150260 15276
2 1230 51304
0
0
0
2 145432 129266
0
2 8841 143795
0
0
2 57013 87754
2 137534 152540
2 104069 6055
2 110770 197377
2 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 200000 numbers

Test #30:

score: 34
Accepted
time: 44ms
memory: 10816kb

input:

199997 50000 199999
2 94991 2169
0
2 72509 166337
0
2 16918 171383
0
0
2 73682 180174
0
2 169374 174543
2 64762 192851
0
0
2 174859 174500
2 76563 17894
0
0
2 150052 31443
2 185329 182627
2 166952 79589
0
2 97973 180210
0
0
0
0
0
2 93742 12427
0
2 41407 3110
2 8109 100196
2 167124 83715
0
2 91714 16...

output:

0
0
0
38767
0
25218
632
1
0
14240
40427
503
14174
0
0
0
0
13306
1
39396
19205
0
0
21371
28154
0
1
6853
35607
31814
10931
0
0
0
0
0
27415
47516
0
0
0
0
0
0
1
0
0
0
1
0
0
0
3702
0
1
0
0
35042
0
18064
0
0
0
0
0
1
0
1
46158
0
0
1
0
0
15366
1
0
19142
1
1
0
5201
1
0
0
0
0
0
0
49963
39489
0
0
13019
0
39120...

result:

ok 199999 numbers

Test #31:

score: 34
Accepted
time: 39ms
memory: 10796kb

input:

199999 40000 200000
2 153021 138684
0
0
0
2 158091 124893
0
0
2 46549 15599
2 90240 154478
0
2 154387 93618
0
2 169300 86260
0
2 160617 111664
0
2 143608 184982
0
2 191793 134269
0
0
2 37431 110537
2 55442 113652
0
0
0
2 52072 21475
0
2 170166 18255
2 147581 118064
0
0
2 166666 177812
0
2 24584 1451...

output:

0
66428
0
1
76034
0
1
0
65493
28982
13593
0
1
14340
0
15870
29535
1
1582
1
3973
1
1
1
1
1
71978
12046
1
0
0
1
0
44417
1
0
0
4658
18783
19450
0
0
35442
1
1
0
0
1
0
1
1
1
1
1
0
54731
6552
1
32989
40342
0
59797
0
0
1
31469
76559
1
0
1
0
1
1
74657
1
1
44277
5873
1
0
34538
1
1
1
1
1
4728
0
1
0
45387
1
1
...

result:

ok 200000 numbers

Extra Test:

score: 0
Extra Test Passed