QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#282591#5404. 述树术zhoukangyang62.493822 9ms6716kbC++143.1kb2023-12-12 14:50:102023-12-12 14:50:10

Judging History

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

  • [2023-12-12 14:50:10]
  • 评测
  • 测评结果:62.493822
  • 用时:9ms
  • 内存:6716kb
  • [2023-12-12 14:50:10]
  • 提交

answer

#include<bits/stdc++.h>
#include"tree.h" 
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define vi vector <int>
#define sz(a) ((int) (a).size())
#define me(f, x) memset(f, x, sizeof(f))
#define uint unsigned int
#define ull unsigned long long 
#define i128 __int128
#define pb emplace_back
using namespace std; 
const int N = 1007;
int n;

int ord[N];
mt19937_64 orz;
map < vi, int > mp;
int GG;
inline int query(vi S) {
	sort(S.begin(), S.end());
	if(mp.count(S))return mp[S]; 
//	for(auto&x : S)
//		x = ord[x]; 
	return mp[S] = Query(S);
} 
void report(int x, int y){
	if(x == -1) return Report(x, y), void();
	Report(x, y);
//	Report(ord[x], ord[y]);
}

int val[N];
int vis[N];
int fa[N]; 

inline int get0(vi S){
	for(auto&u : S)if(fa[u] == 0)return u;
	return 0;
}
void slv(vi S) {
	if(sz(S) <= 1) return;
	if(GG) return;
	shuffle(S.begin(), S.end(), orz);
	L(t, 0, sz(S) - 1) {
		int u = S[t], win = 0;
		for(auto&v : S) 
			if(u == v) val[v] = 1;
			else val[v] = query(vi{u, v}), win |= val[v] > 2;
		if(win) {
//			cout << "u = " << u << endl;
			auto dfs = [&] (auto self, vi ls, vi rs) {
				if(!sz(rs)){
					slv(ls);
					return;
				}
				if(GG)return;
				int p = rs[orz() % sz(rs)];
				int fp = 0; 
				for(auto&r : ls) vis[r] = 0;
				for(auto&r : ls)if(r != u) {
					if(query(vi{p, r}) == 2) vis[r] = 1;
				}
				for(auto&r : ls)if(vis[r]) {
					if(query(vi{u, p, r}) == 3) {
						fp = r;
						break; 
					}
				}
//				cout << u << ", " << p << " and " << fp << endl;
				assert(fp != 0);
				vi L_l, L_r;
				vi R_l, R_r;
				vi midS;
				for(auto&r : ls)if(r != fp){
					if(vis[r]) R_l.emplace_back(r);
					else L_l.emplace_back(r);
				}
				midS.emplace_back(p);
				for(auto&r : rs) if(p != r) {
					if(query(vi{r, fp}) == 3) {
						R_r.emplace_back(r);
					} else if(query(vi{r, u, fp}) == 3) {
						midS.emplace_back(r);
					} else {
						L_r.emplace_back(r);
					}
				}
				slv(midS);
				self(self, L_l, L_r);
				self(self, R_l, R_r);
				if(GG)return;
//				cout << "ok solved" << endl;
				
				fa[get0(midS)] = fp;
				if(sz(L_l))fa[get0(L_l)] = fp;
				int xs = 0;
				for(auto&p : R_l) xs ^= p ^ fa[p];
				if(xs)fa[fp] = xs;
				return;
			};
			vi ls, rs;
			for(auto&u : S) 
				if(val[u] <= 2) ls.emplace_back(u);
				else rs.emplace_back(u);
//			cout << "ls : "; for(auto&x : ls) cout << x << ' '; cout << '\n';
//			cout << "rs : "; for(auto&x : rs) cout << x << ' '; cout << '\n';
			dfs(dfs, ls, rs);
			return;
		}
		if(t == 2) {
//			cout<<"GG.., S = ";
//			for(auto&u:S)cout<<u<<' ';
//			cout<<endl;
			return GG = 1, report(-1, -1), void();	
		} 
	} 
//	cout<<"GG??, S = ";
//	for(auto&u:S)cout<<u<<' ';
//	cout<<endl;
	GG = 1, report(-1, -1);
}

void Solve(int N) {
	n = N; 
	if(n == 2)return report(-1, -1), void();
	
	vi S;
	L(i, 1, n) S.emplace_back(i);
	
	slv(S);
	if(GG)return;
	L(i, 1, n) if(fa[i])report(fa[i], i);
}
/*
11 250000
2 3
4 5
6 7
8 9
10 11
0 0
0 0
0 0
0 0
0 0
1
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 32.1871
Acceptable Answer

Test #1:

score: 34.8179
Acceptable Answer
time: 4ms
memory: 5016kb

input:

499 7890
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0...

output:

1
7676

result:

points 0.69635780480 x = 7676

Test #2:

score: 34.8208
Acceptable Answer
time: 4ms
memory: 4740kb

input:

499 7890
0 0
0 0
0 0
187 351
0 0
337 475
82 233
0 0
0 0
448 134
0 0
5 386
0 0
0 0
343 20
244 442
0 0
392 397
0 0
444 223
180 243
0 0
455 241
40 256
340 346
214 128
0 0
315 451
57 320
0 0
0 0
105 446
287 126
0 0
0 0
122 22
0 0
0 0
0 0
21 305
0 0
60 182
0 0
0 0
0 0
0 0
0 0
0 0
0 0
124 224
9 80
7 294
0...

output:

1
7675

result:

points 0.69641526790 x = 7675

Test #3:

score: 32.1871
Acceptable Answer
time: 4ms
memory: 4936kb

input:

499 7890
0 0
0 0
0 0
145 106
187 3
0 0
0 0
226 44
0 0
0 0
0 0
397 112
0 0
0 0
250 183
365 61
151 302
276 25
0 0
295 136
152 273
256 23
213 351
0 0
0 0
384 240
38 478
0 0
0 0
217 300
79 10
462 288
0 0
0 0
0 0
0 0
0 0
148 311
0 0
0 0
0 0
193 419
270 377
0 0
84 281
0 0
178 451
153 105
133 21
211 283
28...

output:

1
8708

result:

points 0.64374292990 x = 8708

Test #4:

score: 35.4342
Acceptable Answer
time: 4ms
memory: 5048kb

input:

499 7890
0 0
0 0
0 0
163 73
0 0
189 485
0 0
476 293
0 0
0 0
0 0
0 0
447 422
371 118
0 0
24 219
0 0
0 0
0 0
273 25
0 0
0 0
179 419
349 159
0 0
0 0
449 92
0 0
121 412
127 218
0 0
0 0
356 54
39 62
354 370
0 0
247 41
329 369
48 400
0 0
283 402
0 0
0 0
0 0
132 119
0 0
416 302
220 372
0 0
105 312
266 176
...

output:

1
7467

result:

points 0.70868476460 x = 7467

Test #5:

score: 34.4253
Acceptable Answer
time: 4ms
memory: 5084kb

input:

499 7890
0 0
61 429
212 422
0 0
0 0
139 378
0 0
0 0
0 0
207 72
0 0
0 0
371 441
0 0
199 413
60 266
416 363
468 454
419 5
0 0
414 39
126 52
31 113
0 0
140 134
35 444
0 0
0 0
395 455
23 291
69 387
203 274
0 0
0 0
0 0
0 0
0 0
438 487
0 0
0 0
57 467
16 153
0 0
0 0
0 0
0 0
0 0
0 0
146 196
284 390
121 380
...

output:

1
7815

result:

points 0.68850621160 x = 7815

Test #6:

score: 38.5322
Acceptable Answer
time: 3ms
memory: 4620kb

input:

499 7890
0 0
289 462
395 207
453 204
0 0
0 0
0 0
0 0
479 312
0 0
108 100
5 211
279 270
0 0
423 365
0 0
0 0
0 0
0 0
9 132
0 0
0 0
11 304
0 0
0 0
428 232
0 0
0 0
0 0
0 0
407 131
349 88
174 415
386 296
404 444
0 0
355 64
0 0
448 139
91 199
0 0
205 299
0 0
123 67
0 0
0 0
0 0
0 0
414 2
0 0
397 127
309 22...

output:

1
6562

result:

points 0.77064440340 x = 6562

Test #7:

score: 34.2681
Acceptable Answer
time: 4ms
memory: 5044kb

input:

499 7890
0 0
0 0
0 0
293 172
234 459
272 292
71 177
0 0
0 0
0 0
484 444
143 244
0 0
310 33
0 0
46 74
110 356
280 263
0 0
0 0
0 0
0 0
411 181
0 0
0 0
455 281
0 0
0 0
203 44
0 0
0 0
260 13
182 397
187 88
0 0
0 0
0 0
155 75
23 496
0 0
66 443
159 174
185 274
0 0
278 213
424 92
0 0
126 478
399 168
0 0
0 ...

output:

1
7872

result:

points 0.68536251910 x = 7872

Test #8:

score: 36.3655
Acceptable Answer
time: 4ms
memory: 4720kb

input:

499 7890
0 0
0 0
0 0
0 0
0 0
111 454
0 0
397 253
400 478
283 213
179 2
0 0
239 172
303 304
128 457
0 0
0 0
288 88
0 0
308 263
0 0
0 0
0 0
0 0
341 280
15 59
214 29
0 0
0 0
416 3
93 233
451 319
0 0
0 0
90 140
0 0
0 0
0 0
197 159
6 266
27 427
0 0
365 154
293 193
0 0
270 321
0 0
44 33
0 0
461 198
32 186...

output:

1
7171

result:

points 0.72730908030 x = 7171

Test #9:

score: 36.258
Acceptable Answer
time: 4ms
memory: 4728kb

input:

499 7890
120 69
312 89
0 0
0 0
0 0
0 0
0 0
0 0
59 407
372 342
0 0
63 141
227 269
0 0
0 0
0 0
50 329
0 0
0 0
185 285
40 211
104 194
0 0
0 0
234 439
327 246
245 461
405 204
88 10
0 0
0 0
34 57
0 0
0 0
128 143
0 0
0 0
49 13
26 393
455 190
0 0
0 0
147 18
0 0
0 0
459 318
0 0
313 256
476 111
0 0
440 58
44...

output:

1
7204

result:

points 0.72516065440 x = 7204

Test #10:

score: 33.7202
Acceptable Answer
time: 4ms
memory: 4840kb

input:

499 7890
357 56
0 0
0 0
0 0
0 0
144 333
171 156
0 0
0 0
0 0
180 437
0 0
0 0
0 0
0 0
0 0
0 0
207 224
0 0
0 0
0 0
0 0
0 0
364 84
0 0
0 0
466 25
0 0
375 148
0 0
0 0
0 0
0 0
331 319
483 18
244 240
450 187
456 142
0 0
444 492
100 283
35 317
0 0
188 10
0 0
0 0
0 0
0 0
281 152
343 64
477 5
378 76
413 198
0...

output:

1
8077

result:

points 0.67440390950 x = 8077

Test #11:

score: 33.2929
Acceptable Answer
time: 4ms
memory: 4876kb

input:

499 7890
279 484
54 69
0 0
448 262
161 173
0 0
460 214
0 0
60 301
0 0
0 0
457 80
464 165
0 0
47 18
0 0
232 273
0 0
0 0
0 0
23 436
0 0
377 305
0 0
488 138
0 0
0 0
123 178
63 14
0 0
0 0
0 0
476 218
0 0
0 0
0 0
0 0
0 0
225 217
131 498
408 122
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
365 386
0 0
434 443
30 357
1...

output:

1
8244

result:

points 0.6658581970 x = 8244

Test #12:

score: 37.9897
Acceptable Answer
time: 4ms
memory: 4940kb

input:

499 7890
0 0
262 277
2 148
0 0
174 417
0 0
293 162
0 0
0 0
113 8
0 0
0 0
214 59
0 0
0 0
414 47
0 0
0 0
0 0
124 360
0 0
184 348
0 0
78 49
0 0
280 119
346 315
390 71
0 0
301 19
0 0
0 0
388 127
114 207
0 0
0 0
327 91
216 338
0 0
129 103
0 0
0 0
0 0
208 292
222 156
373 451
0 0
353 337
0 0
485 149
0 0
0 ...

output:

1
6705

result:

points 0.7597942750 x = 6705

Test #13:

score: 37.6125
Acceptable Answer
time: 3ms
memory: 4676kb

input:

499 7890
270 456
0 0
0 0
128 434
0 0
225 392
0 0
0 0
54 148
407 278
0 0
0 0
0 0
41 119
77 232
378 374
419 129
420 207
0 0
125 357
0 0
0 0
55 310
0 0
0 0
39 339
388 3
0 0
0 0
0 0
108 330
0 0
0 0
0 0
0 0
60 100
0 0
0 0
181 454
0 0
417 120
0 0
145 190
0 0
319 256
2 421
0 0
0 0
0 0
0 0
136 422
153 96
10...

output:

1
6808

result:

points 0.75224910350 x = 6808

Test #14:

score: 32.3307
Acceptable Answer
time: 4ms
memory: 4912kb

input:

499 7890
370 175
213 404
0 0
0 0
0 0
0 0
0 0
236 474
441 371
250 79
417 159
0 0
0 0
0 0
132 483
0 0
71 162
392 428
0 0
0 0
221 424
214 437
45 88
0 0
74 239
0 0
0 0
186 355
22 64
0 0
349 409
163 35
43 136
0 0
0 0
0 0
171 365
408 492
0 0
107 36
4 241
106 201
268 254
150 278
225 147
486 473
419 235
444...

output:

1
8645

result:

points 0.64661419680 x = 8645

Test #15:

score: 33.8145
Acceptable Answer
time: 4ms
memory: 4840kb

input:

499 7890
376 112
114 360
0 0
0 0
0 0
172 486
0 0
158 490
0 0
218 73
375 479
336 155
0 0
0 0
120 11
150 496
37 403
401 380
0 0
0 0
133 122
205 278
410 62
448 228
245 170
0 0
0 0
251 472
135 236
140 406
435 85
0 0
214 431
0 0
151 246
0 0
0 0
292 127
305 347
0 0
0 0
0 0
442 224
453 226
0 0
123 438
0 0
...

output:

1
8041

result:

points 0.67629005570 x = 8041

Test #16:

score: 35.1589
Acceptable Answer
time: 4ms
memory: 4792kb

input:

499 7890
0 0
0 0
0 0
0 0
62 451
0 0
283 419
0 0
228 327
0 0
403 496
0 0
444 180
34 279
0 0
0 0
0 0
0 0
366 201
0 0
0 0
431 248
0 0
0 0
0 0
171 63
207 498
387 46
0 0
325 270
165 8
115 103
428 466
303 346
98 249
0 0
0 0
0 0
0 0
321 478
0 0
0 0
0 0
182 164
185 226
0 0
0 0
213 44
0 0
416 417
0 0
69 359
...

output:

1
7559

result:

points 0.70317881940 x = 7559

Test #17:

score: 34.1185
Acceptable Answer
time: 0ms
memory: 5052kb

input:

499 7890
458 88
425 362
0 0
0 0
0 0
0 0
0 0
396 442
0 0
113 388
401 187
0 0
82 115
0 0
367 489
173 48
0 0
19 370
208 209
0 0
374 219
0 0
0 0
45 86
0 0
0 0
280 409
177 476
0 0
0 0
37 327
475 285
0 0
21 144
6 207
0 0
8 334
257 379
57 351
0 0
0 0
0 0
224 294
0 0
391 116
488 31
0 0
120 211
490 293
421 1...

output:

1
7927

result:

points 0.68236974540 x = 7927

Test #18:

score: 35.3287
Acceptable Answer
time: 4ms
memory: 4844kb

input:

499 7890
0 0
109 334
0 0
301 141
0 0
0 0
127 454
222 485
0 0
133 451
0 0
282 33
0 0
0 0
0 0
0 0
0 0
0 0
0 0
165 28
388 1
0 0
0 0
0 0
308 57
0 0
340 330
231 183
321 476
0 0
226 326
0 0
386 39
30 200
44 160
0 0
350 198
0 0
467 32
0 0
137 59
0 0
0 0
0 0
70 325
49 34
0 0
230 216
0 0
410 449
299 472
245 ...

output:

1
7502

result:

points 0.70657499840 x = 7502

Test #19:

score: 34.5061
Acceptable Answer
time: 4ms
memory: 4820kb

input:

499 7890
0 0
86 259
323 47
0 0
0 0
0 0
0 0
424 172
202 337
428 461
283 197
0 0
210 208
485 25
0 0
0 0
0 0
417 20
0 0
0 0
88 425
0 0
0 0
0 0
301 396
250 256
130 164
0 0
74 276
0 0
0 0
153 101
0 0
0 0
0 0
247 87
0 0
0 0
390 447
450 32
243 216
70 255
0 0
0 0
19 364
0 0
0 0
0 0
203 471
288 66
245 84
146...

output:

1
7786

result:

points 0.69012237010 x = 7786

Test #20:

score: 34.6157
Acceptable Answer
time: 4ms
memory: 4764kb

input:

499 7890
0 0
306 330
0 0
0 0
320 310
0 0
0 0
0 0
0 0
0 0
179 423
149 256
0 0
0 0
129 146
371 386
83 74
318 253
401 177
42 144
0 0
0 0
339 267
0 0
0 0
0 0
115 172
0 0
464 215
252 105
0 0
0 0
0 0
0 0
388 482
344 148
328 313
154 442
0 0
334 221
0 0
0 0
389 449
0 0
0 0
140 424
0 0
0 0
122 21
211 406
322...

output:

1
7747

result:

points 0.69231390310 x = 7747

Test #21:

score: 32.7711
Acceptable Answer
time: 4ms
memory: 4896kb

input:

499 7890
430 466
263 264
275 360
389 36
0 0
0 0
349 111
88 218
432 132
0 0
183 351
260 130
209 182
0 0
0 0
450 256
0 0
0 0
440 28
38 388
454 142
0 0
0 0
212 171
0 0
117 372
0 0
77 213
245 423
8 97
0 0
484 422
359 442
0 0
0 0
0 0
356 140
0 0
0 0
214 19
310 428
250 73
75 480
0 0
124 220
0 0
0 0
0 0
0 ...

output:

1
8457

result:

points 0.65542189220 x = 8457

Test #22:

score: 34.9392
Acceptable Answer
time: 4ms
memory: 4812kb

input:

499 7890
0 0
0 0
0 0
39 416
377 94
329 86
433 417
0 0
444 403
0 0
449 452
310 52
0 0
248 136
0 0
177 64
69 90
399 195
159 428
85 240
288 229
203 457
7 133
0 0
306 125
10 215
0 0
0 0
224 228
80 184
151 100
367 359
471 462
389 483
343 12
0 0
400 252
480 467
0 0
60 137
0 0
0 0
16 254
0 0
0 0
463 198
43...

output:

1
7634

result:

points 0.69878354580 x = 7634

Test #23:

score: 34.7606
Acceptable Answer
time: 4ms
memory: 4800kb

input:

499 7890
232 102
0 0
0 0
0 0
0 0
234 148
0 0
203 41
0 0
409 306
0 0
0 0
0 0
395 414
0 0
491 479
262 137
146 481
59 420
0 0
0 0
0 0
0 0
0 0
189 296
0 0
422 266
89 124
349 190
0 0
0 0
466 163
257 260
337 107
334 66
0 0
470 287
0 0
301 243
0 0
434 432
433 185
326 447
0 0
0 0
348 125
0 0
429 227
281 182...

output:

1
7696

result:

points 0.69521151920 x = 7696

Test #24:

score: 37.8898
Acceptable Answer
time: 3ms
memory: 4904kb

input:

499 7890
234 323
128 190
51 419
0 0
136 344
0 0
0 0
260 311
0 0
105 490
0 0
362 456
0 0
496 67
239 131
0 0
188 282
59 34
96 285
399 194
0 0
0 0
126 435
300 286
0 0
395 279
0 0
5 488
478 238
72 462
0 0
135 133
0 0
486 372
0 0
0 0
118 370
0 0
0 0
0 0
0 0
0 0
0 0
80 489
0 0
272 54
0 0
87 261
0 0
0 0
0 ...

output:

1
6732

result:

points 0.75779509670 x = 6732

Test #25:

score: 33.3457
Acceptable Answer
time: 4ms
memory: 5128kb

input:

499 7890
96 437
0 0
103 349
0 0
235 282
255 249
0 0
135 167
0 0
0 0
51 365
120 95
408 134
0 0
348 146
66 470
305 369
0 0
400 486
0 0
0 0
472 80
205 412
287 346
499 70
0 0
0 0
389 104
89 299
119 219
0 0
57 202
0 0
0 0
48 69
58 334
335 495
0 0
398 279
0 0
471 314
0 0
0 0
414 91
0 0
56 228
0 0
0 0
0 0
...

output:

1
8223

result:

points 0.66691476690 x = 8223

Test #26:

score: 34.2462
Acceptable Answer
time: 4ms
memory: 4828kb

input:

499 7890
0 0
0 0
0 0
269 126
187 484
0 0
0 0
400 4
0 0
93 73
0 0
324 467
298 372
0 0
0 0
176 437
338 413
156 193
0 0
0 0
0 0
0 0
259 274
0 0
169 99
137 357
30 17
469 20
0 0
0 0
353 173
365 494
0 0
11 432
0 0
445 284
0 0
142 5
211 381
0 0
87 65
376 392
86 287
0 0
312 242
371 451
444 53
387 148
0 0
0 ...

output:

1
7880

result:

points 0.68492474770 x = 7880

Test #27:

score: 37.1377
Acceptable Answer
time: 3ms
memory: 4968kb

input:

499 7890
371 440
0 0
0 0
0 0
0 0
71 96
384 283
0 0
0 0
211 434
0 0
485 221
0 0
89 25
20 271
0 0
295 468
389 246
0 0
0 0
0 0
0 0
0 0
157 57
31 238
0 0
373 347
0 0
256 68
60 250
0 0
0 0
319 13
332 448
82 175
0 0
287 286
0 0
0 0
491 475
72 390
0 0
0 0
129 493
0 0
207 284
0 0
344 478
0 0
317 361
0 0
432...

output:

1
6942

result:

points 0.7427531380 x = 6942

Test #28:

score: 34.6298
Acceptable Answer
time: 4ms
memory: 5076kb

input:

499 7890
46 439
111 336
0 0
282 340
0 0
0 0
269 144
374 373
0 0
491 16
250 358
62 452
409 201
152 351
0 0
221 379
169 302
494 364
0 0
0 0
0 0
327 326
0 0
383 372
15 335
0 0
0 0
0 0
451 41
419 34
0 0
400 1
361 18
186 196
0 0
0 0
0 0
347 149
294 75
203 423
161 103
81 80
6 448
0 0
0 0
0 0
0 0
180 417
0...

output:

1
7742

result:

points 0.69259638240 x = 7742

Test #29:

score: 50
Accepted
time: 0ms
memory: 3976kb

input:

3 7890
0 0
1 3
0 0
1

output:

1
4

result:

points 1.0 x = 4

Subtask #2:

score: 30.3067
Acceptable Answer

Test #30:

score: 34.563
Acceptable Answer
time: 6ms
memory: 5932kb

input:

999 16789
0 0
0 0
0 0
495 639
428 443
0 0
511 28
0 0
0 0
0 0
0 0
31 729
899 866
429 959
357 322
795 615
235 620
0 0
0 0
85 389
33 50
234 522
276 468
480 269
0 0
705 536
0 0
87 446
889 578
86 472
0 0
699 53
0 0
706 976
381 493
0 0
441 164
0 0
0 0
0 0
283 215
0 0
113 208
334 225
372 487
0 0
878 418
0 ...

output:

1
18120

result:

points 0.69125968430 x = 18120

Test #31:

score: 34.6391
Acceptable Answer
time: 6ms
memory: 5956kb

input:

1000 16789
515 849
0 0
0 0
0 0
0 0
368 669
0 0
0 0
664 904
40 982
881 383
0 0
736 545
0 0
0 0
364 111
0 0
663 420
0 0
0 0
0 0
0 0
147 445
566 207
873 282
0 0
132 443
0 0
0 0
0 0
0 0
685 482
0 0
0 0
0 0
0 0
0 0
0 0
812 189
655 338
60 20
358 671
0 0
0 0
0 0
594 296
520 333
433 622
0 0
239 943
0 0
0 0
...

output:

1
18057

result:

points 0.69278220020 x = 18057

Test #32:

score: 37.9563
Acceptable Answer
time: 8ms
memory: 5976kb

input:

1000 16789
0 0
612 121
525 683
960 876
557 334
479 708
500 364
0 0
376 764
0 0
368 384
963 329
0 0
0 0
624 878
0 0
875 853
889 585
249 485
0 0
0 0
982 440
0 0
0 0
184 754
0 0
0 0
0 0
0 0
562 983
0 0
387 276
0 0
0 0
0 0
0 0
0 0
742 852
919 191
414 34
868 89
104 359
234 174
0 0
0 0
0 0
510 46
316 74
4...

output:

1
15666

result:

points 0.7591261760 x = 15666

Test #33:

score: 50
Accepted
time: 5ms
memory: 5364kb

input:

1000 16789
0 0
0 0
438 183
0 0
0 0
370 907
0 0
0 0
731 101
339 575
276 497
135 762
0 0
108 607
926 38
0 0
240 405
0 0
0 0
13 22
0 0
0 0
83 890
679 132
744 819
0 0
0 0
173 229
0 0
0 0
391 791
488 680
0 0
0 0
0 0
916 499
668 804
576 54
0 0
0 0
0 0
0 0
495 912
349 690
0 0
0 0
0 0
0 0
551 904
569 454
0 ...

output:

1
10379

result:

points 1.0 x = 10379

Test #34:

score: 36.9895
Acceptable Answer
time: 3ms
memory: 5744kb

input:

1000 16789
0 0
0 0
560 526
575 810
354 638
485 62
0 0
0 0
812 750
0 0
422 88
0 0
0 0
0 0
0 0
124 969
361 835
0 0
0 0
930 515
669 241
932 81
159 141
0 0
0 0
36 84
0 0
0 0
0 0
129 11
0 0
0 0
331 79
0 0
953 45
0 0
0 0
685 977
0 0
242 552
663 739
0 0
249 226
0 0
238 858
805 884
0 0
0 0
917 458
0 0
0 0
0...

output:

1
16298

result:

points 0.73978942360 x = 16298

Test #35:

score: 35.3644
Acceptable Answer
time: 9ms
memory: 6184kb

input:

1000 16789
0 0
0 0
634 912
0 0
242 533
586 628
0 0
760 98
0 0
0 0
948 873
780 781
0 0
0 0
0 0
0 0
777 342
0 0
0 0
0 0
96 593
0 0
753 281
110 838
966 270
482 927
951 746
162 103
0 0
0 0
0 0
0 0
314 654
0 0
0 0
58 71
230 228
992 764
0 0
0 0
0 0
0 0
414 403
424 3
0 0
291 721
788 94
743 218
930 44
787 5...

output:

1
17477

result:

points 0.70728763790 x = 17477

Test #36:

score: 30.3067
Acceptable Answer
time: 7ms
memory: 6716kb

input:

1000 16789
0 0
0 0
613 0
609 543
438 948
616 0
583 0
0 0
0 0
0 0
0 0
394 0
900 0
49 530
823 0
705 514
227 474
0 0
678 101
237 0
192 0
784 0
0 0
215 869
890 0
0 0
201 747
0 0
663 0
929 421
128 829
0 0
0 0
0 0
986 552
0 0
146 0
0 0
0 0
377 145
129 953
0 0
0 0
483 852
35 0
813 96
794 143
0 0
0 0
806 14...

output:

1
22448

result:

points 0.60613350150 x = 22448

Test #37:

score: 40.4134
Acceptable Answer
time: 7ms
memory: 5828kb

input:

1000 16789
652 0
0 0
0 0
517 811
32 775
760 470
914 457
0 0
0 0
252 666
0 0
408 0
0 0
823 0
667 162
0 0
286 169
527 0
0 0
765 711
918 0
0 0
869 725
799 974
888 212
512 878
0 0
0 0
0 0
201 43
426 0
646 590
0 0
0 0
592 728
70 902
0 0
454 34
0 0
0 0
593 0
246 355
0 0
865 821
603 120
0 0
0 0
121 0
0 0
8...

output:

1
14253

result:

points 0.80826756930 x = 14253

Test #38:

score: 38.5427
Acceptable Answer
time: 7ms
memory: 5748kb

input:

1000 16789
175 453
0 0
170 0
59 333
495 803
591 310
597 449
925 0
0 0
253 433
335 464
232 0
455 693
614 510
324 914
272 0
287 269
313 0
408 842
992 289
677 373
462 747
0 0
0 0
512 653
0 0
0 0
19 0
95 0
725 320
0 0
0 0
403 0
217 0
0 0
634 391
0 0
0 0
0 0
868 746
0 0
0 0
374 37
424 263
918 0
434 321
0...

output:

1
15305

result:

points 0.77085472130 x = 15305

Test #39:

score: 43.5768
Acceptable Answer
time: 6ms
memory: 5344kb

input:

1000 16789
552 0
0 0
762 765
438 949
0 0
0 0
950 846
488 970
0 0
429 641
0 0
508 0
0 0
0 0
0 0
257 823
0 0
0 0
0 0
210 0
0 0
828 152
0 0
164 710
953 0
0 0
502 639
740 0
66 190
0 0
360 0
0 0
117 538
0 0
338 120
191 0
0 0
0 0
0 0
0 0
691 0
578 680
0 0
998 693
0 0
967 0
0 0
10 0
95 591
629 0
0 0
102 0
...

output:

1
12759

result:

points 0.87153584110 x = 12759

Test #40:

score: 40.0321
Acceptable Answer
time: 7ms
memory: 5584kb

input:

1000 16789
704 0
10 0
0 0
323 894
483 846
35 0
816 0
970 321
634 360
226 918
0 0
0 0
459 0
70 64
182 0
573 0
902 0
108 736
886 0
0 0
616 372
0 0
897 790
0 0
997 0
42 0
691 259
601 0
0 0
498 981
0 0
529 131
246 755
648 0
319 213
796 0
270 520
544 0
0 0
591 317
0 0
262 228
956 39
192 0
673 986
0 0
535...

output:

1
14456

result:

points 0.80064218760 x = 14456

Test #41:

score: 41.0938
Acceptable Answer
time: 7ms
memory: 5780kb

input:

1000 16789
751 0
603 0
287 766
50 0
729 0
817 709
348 977
0 0
0 0
718 0
141 0
0 0
0 0
77 437
0 0
396 0
127 0
0 0
0 0
0 0
565 0
0 0
515 639
755 0
661 334
0 0
0 0
353 0
0 0
0 0
870 711
880 511
454 0
422 0
888 936
0 0
0 0
429 0
128 704
720 108
680 795
0 0
0 0
536 0
134 611
159 72
467 78
806 99
0 0
968 ...

output:

1
13904

result:

points 0.82187616870 x = 13904

Test #42:

score: 39.8957
Acceptable Answer
time: 7ms
memory: 5592kb

input:

1000 16789
911 689
475 592
55 0
0 0
0 0
868 760
167 29
0 0
508 366
0 0
619 440
0 0
338 0
0 0
30 0
784 0
385 217
870 493
0 0
454 0
460 0
0 0
0 0
990 0
297 202
149 590
218 0
0 0
686 0
161 86
0 0
271 0
834 0
286 0
111 0
762 797
0 0
0 0
0 0
575 634
279 284
855 0
166 837
0 0
0 0
862 0
0 0
738 0
488 254
7...

output:

1
14530

result:

points 0.79791332060 x = 14530

Test #43:

score: 36.4941
Acceptable Answer
time: 4ms
memory: 5800kb

input:

1000 16789
0 0
0 0
447 735
0 0
0 0
181 651
315 762
0 0
999 550
722 526
0 0
0 0
0 0
0 0
0 0
0 0
688 154
0 0
0 0
0 0
0 0
0 0
585 139
115 164
637 775
430 616
708 151
0 0
781 359
725 496
146 130
689 746
356 463
995 5
0 0
0 0
7 751
970 379
215 655
0 0
281 697
485 791
787 2
0 0
863 283
0 0
569 857
0 0
0 0...

output:

1
16641

result:

points 0.72988196270 x = 16641

Test #44:

score: 36.9747
Acceptable Answer
time: 5ms
memory: 5792kb

input:

1000 16789
284 558
746 45
0 0
0 0
813 939
905 322
0 0
0 0
0 0
0 0
47 77
337 816
0 0
92 176
0 0
291 317
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
83 918
382 129
0 0
0 0
0 0
379 851
0 0
0 0
0 0
491 310
540 663
0 0
647 982
0 0
0 0
0 0
910 264
767 185
0 0
0 0
788 673
299 135
0 0
0 0
0 0
966 538
0 0
840 107
10...

output:

1
16308

result:

points 0.73949495810 x = 16308

Test #45:

score: 35.336
Acceptable Answer
time: 6ms
memory: 5904kb

input:

1000 16789
752 326
0 0
553 0
101 0
631 0
337 312
774 0
370 375
0 0
794 0
850 85
19 0
645 0
978 646
983 0
160 0
0 0
574 0
973 182
0 0
715 68
0 0
0 0
0 0
801 0
856 216
0 0
84 2
449 10
0 0
0 0
942 420
0 0
0 0
0 0
502 270
0 0
448 0
873 441
0 0
686 177
153 0
115 0
0 0
711 0
594 0
0 0
910 685
952 0
0 0
70...

output:

1
17499

result:

points 0.70672078640 x = 17499

Test #46:

score: 40.2186
Acceptable Answer
time: 7ms
memory: 5592kb

input:

1000 16789
977 230
0 0
0 0
531 930
850 0
220 0
0 0
441 0
0 0
0 0
840 321
0 0
523 0
383 0
914 346
0 0
394 0
0 0
283 618
0 0
615 471
0 0
688 169
460 0
0 0
209 0
816 884
973 653
589 0
24 266
848 0
972 0
906 849
0 0
313 0
0 0
957 0
765 0
749 338
701 634
538 0
705 663
0 0
0 0
0 0
0 0
819 689
0 0
0 0
510 ...

output:

1
14356

result:

points 0.80437268660 x = 14356

Test #47:

score: 36.1506
Acceptable Answer
time: 8ms
memory: 5864kb

input:

1000 16789
0 0
111 0
170 239
0 0
0 0
83 115
537 207
110 0
862 0
652 0
362 0
263 827
3 0
467 0
0 0
0 0
0 0
123 342
0 0
49 0
338 385
754 768
746 421
0 0
0 0
317 420
294 0
0 0
840 417
910 0
224 0
228 0
393 0
327 0
0 0
483 0
0 0
549 78
152 0
335 0
367 0
0 0
21 0
904 0
90 647
532 882
565 0
0 0
665 122
0 ...

output:

1
16887

result:

points 0.72301252060 x = 16887

Test #48:

score: 36.097
Acceptable Answer
time: 8ms
memory: 5872kb

input:

1000 16789
0 0
0 0
0 0
0 0
0 0
0 0
108 0
0 0
134 513
986 518
0 0
799 765
131 206
651 0
267 388
0 0
511 562
450 0
0 0
767 0
0 0
0 0
711 0
0 0
0 0
0 0
704 683
984 550
0 0
250 0
0 0
539 591
485 0
0 0
377 0
0 0
902 0
981 164
7 554
938 948
636 752
424 733
0 0
82 16
0 0
0 0
348 8
0 0
758 0
534 0
115 0
0 0...

output:

1
16926

result:

points 0.72194091960 x = 16926

Test #49:

score: 35.8783
Acceptable Answer
time: 8ms
memory: 5888kb

input:

1000 16789
179 0
967 267
0 0
0 0
71 408
815 0
970 154
0 0
423 938
0 0
145 0
676 634
996 0
608 643
182 308
352 0
0 0
0 0
105 118
360 0
0 0
0 0
0 0
716 0
0 0
837 0
80 109
0 0
494 374
0 0
666 543
517 922
0 0
186 0
762 206
436 0
0 0
759 790
0 0
119 0
0 0
326 486
0 0
47 79
498 729
336 0
0 0
744 661
978 0...

output:

1
17087

result:

points 0.71756640290 x = 17087

Test #50:

score: 35.5739
Acceptable Answer
time: 9ms
memory: 5920kb

input:

1000 16789
0 0
0 0
800 964
117 949
471 0
0 0
68 55
0 0
715 657
721 300
0 0
348 0
527 745
0 0
62 910
289 346
373 0
801 0
0 0
277 0
392 69
232 0
640 0
0 0
266 0
664 147
730 0
0 0
915 186
723 107
931 0
765 0
138 376
0 0
736 0
0 0
136 41
986 0
643 0
103 0
30 0
0 0
888 946
810 992
411 218
0 0
366 570
920...

output:

1
17316

result:

points 0.71147759140 x = 17316

Test #51:

score: 33.7676
Acceptable Answer
time: 9ms
memory: 6072kb

input:

1000 16789
0 0
0 0
0 0
0 0
977 0
0 0
683 0
0 0
0 0
0 0
0 0
427 0
270 0
0 0
166 0
324 0
0 0
250 0
24 269
955 23
266 381
616 0
0 0
0 0
624 734
409 0
0 0
893 90
672 175
0 0
722 214
0 0
603 0
0 0
0 0
869 0
519 462
0 0
0 0
89 0
532 0
380 5
0 0
393 0
278 966
280 0
993 481
110 952
0 0
870 0
793 460
907 742...

output:

1
18804

result:

points 0.67535247470 x = 18804

Test #52:

score: 35.4044
Acceptable Answer
time: 9ms
memory: 5924kb

input:

1000 16789
393 762
261 676
544 117
396 0
0 0
0 0
0 0
0 0
537 0
165 0
0 0
919 0
0 0
0 0
346 0
0 0
607 0
443 0
304 905
242 0
308 743
0 0
983 0
0 0
0 0
453 606
992 0
90 356
137 880
238 989
613 583
359 0
804 907
500 49
569 485
0 0
437 496
685 0
0 0
0 0
26 0
440 993
0 0
85 0
95 0
721 892
9 916
425 825
58...

output:

1
17446

result:

points 0.70808868780 x = 17446

Test #53:

score: 46.8525
Acceptable Answer
time: 6ms
memory: 5256kb

input:

1000 16789
960 190
0 0
0 0
929 0
0 0
234 280
590 651
26 49
345 173
0 0
316 0
11 97
373 0
122 0
388 0
0 0
0 0
63 0
897 0
513 977
171 359
0 0
0 0
0 0
646 662
928 0
0 0
239 0
791 0
0 0
165 537
614 50
144 0
910 0
752 329
542 729
763 692
21 0
714 0
0 0
0 0
0 0
2 386
0 0
458 0
531 0
0 0
260 461
863 0
0 0
...

output:

1
11501

result:

points 0.93704924590 x = 11501

Test #54:

score: 38.5943
Acceptable Answer
time: 8ms
memory: 5884kb

input:

1000 16789
378 0
852 36
966 0
263 566
469 222
0 0
639 0
125 128
0 0
0 0
354 0
0 0
788 0
0 0
969 0
0 0
51 0
778 237
0 0
24 0
678 0
0 0
906 445
883 233
0 0
0 0
940 995
942 165
941 0
0 0
254 0
0 0
742 0
502 0
575 315
0 0
553 1000
546 0
306 0
301 0
545 0
164 402
0 0
0 0
895 25
990 43
232 214
0 0
0 0
994...

output:

1
15274

result:

points 0.7718865780 x = 15274

Test #55:

score: 36.6537
Acceptable Answer
time: 8ms
memory: 6068kb

input:

1000 16789
204 0
565 0
535 685
259 892
202 329
757 671
572 0
401 0
630 968
397 497
990 673
972 0
963 641
331 462
289 0
0 0
0 0
865 0
973 0
0 0
416 0
0 0
0 0
851 0
451 0
841 0
0 0
0 0
740 0
53 156
50 636
900 929
31 0
0 0
755 285
0 0
999 0
850 0
0 0
742 779
362 0
0 0
526 0
0 0
0 0
798 0
438 0
454 803
...

output:

1
16529

result:

points 0.73307397660 x = 16529

Test #56:

score: 40.6302
Acceptable Answer
time: 7ms
memory: 5800kb

input:

1000 16789
172 0
905 0
945 0
0 0
248 0
652 2
124 989
637 596
0 0
432 77
0 0
0 0
0 0
0 0
0 0
68 451
405 408
0 0
0 0
0 0
0 0
0 0
208 0
659 0
0 0
0 0
195 259
368 0
667 413
0 0
0 0
279 424
780 129
530 0
439 685
0 0
0 0
174 0
0 0
18 951
747 469
940 364
0 0
776 560
388 887
0 0
430 968
713 971
0 0
884 0
34...

output:

1
14140

result:

points 0.81260319730 x = 14140

Test #57:

score: 34.0427
Acceptable Answer
time: 9ms
memory: 6292kb

input:

1000 16789
0 0
751 0
762 703
182 0
328 500
193 0
287 566
0 0
832 0
818 398
339 0
0 0
0 0
0 0
0 0
476 34
0 0
779 0
72 0
447 501
0 0
29 244
0 0
367 130
0 0
47 104
0 0
0 0
0 0
54 723
0 0
0 0
0 0
1 391
908 87
0 0
0 0
0 0
140 842
265 417
301 416
926 518
0 0
0 0
667 0
943 999
0 0
784 0
669 968
532 618
603...

output:

1
18562

result:

points 0.68085353810 x = 18562

Test #58:

score: 42.4177
Acceptable Answer
time: 6ms
memory: 5480kb

input:

1000 16789
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0...

output:

1
13270

result:

points 0.84835445610 x = 13270

Test #59:

score: 40.6999
Acceptable Answer
time: 6ms
memory: 5816kb

input:

998 16789
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 ...

output:

1
14104

result:

points 0.81399845970 x = 14104

Test #60:

score: 50
Accepted
time: 0ms
memory: 3968kb

input:

2 16789
0 0
1 0
0

output:

1
0

result:

points 1.0 x = 0

Test #61:

score: 50
Accepted
time: 0ms
memory: 3904kb

input:

4 16789
0 0
3 0
1 4
0 0
1

output:

1
7

result:

points 1.0 x = 7

Test #62:

score: 50
Accepted
time: 0ms
memory: 3852kb

input:

4 16789
3 0
0 0
4 0
2 0
0

output:

1
6

result:

points 1.0 x = 6

Test #63:

score: 35.2425
Acceptable Answer
time: 9ms
memory: 5936kb

input:

1000 16789
0 0
182 0
208 876
0 0
720 0
189 0
0 0
50 0
0 0
74 0
60 100
0 0
150 28
774 0
0 0
0 0
56 833
0 0
988 0
0 0
0 0
561 144
702 0
951 0
137 0
156 539
10 840
0 0
61 690
786 31
201 0
426 611
634 15
0 0
0 0
624 757
0 0
0 0
580 994
0 0
266 980
639 0
0 0
97 733
455 0
891 0
662 0
250 341
778 140
390 2...

output:

1
17572

result:

points 0.70484952870 x = 17572

Test #64:

score: 50
Accepted
time: 4ms
memory: 5056kb

input:

1000 16789
329 0
835 0
205 652
660 323
404 0
0 0
0 0
44 0
694 224
0 0
0 0
339 407
174 0
77 0
0 0
449 514
740 40
613 0
0 0
350 520
0 0
306 0
124 353
317 0
666 610
672 0
0 0
243 0
327 743
270 0
0 0
677 0
509 996
0 0
423 622
361 381
0 0
0 0
0 0
0 0
754 0
0 0
242 66
963 945
678 674
0 0
0 0
501 0
231 519...

output:

1
7349

result:

points 1.0 x = 7349

Test #65:

score: 34.0703
Acceptable Answer
time: 9ms
memory: 6312kb

input:

1000 16789
268 440
551 126
59 896
843 0
91 794
977 179
673 185
0 0
817 430
881 0
679 0
554 0
930 0
218 0
0 0
0 0
0 0
0 0
698 0
0 0
394 0
761 0
0 0
724 0
156 370
534 0
0 0
876 0
0 0
806 0
701 0
0 0
646 0
0 0
689 390
786 0
710 0
212 0
0 0
49 665
855 204
132 776
932 0
868 400
0 0
848 0
853 676
0 0
688 ...

output:

1
18538

result:

points 0.68140650570 x = 18538

Test #66:

score: 48.5255
Acceptable Answer
time: 5ms
memory: 5452kb

input:

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

output:

1
10947

result:

points 0.97050958130 x = 10947

Test #67:

score: 50
Accepted
time: 4ms
memory: 4912kb

input:

1000 10500
893 264
553 363
664 0
746 74
530 0
518 160
932 0
688 0
501 0
263 0
676 783
716 69
76 126
686 301
500 0
0 0
79 0
786 0
552 0
293 0
726 143
0 0
927 924
0 0
943 0
0 0
705 327
470 870
0 0
164 0
0 0
777 781
0 0
852 0
0 0
600 113
270 0
256 0
868 900
0 0
0 0
754 0
547 0
0 0
625 0
0 0
75 671
216 ...

output:

1
8130

result:

points 1.0 x = 8130

Test #68:

score: 50
Accepted
time: 4ms
memory: 4960kb

input:

1000 10500
0 0
0 0
744 98
0 0
118 0
267 203
0 0
0 0
0 0
181 79
545 765
45 0
186 957
469 0
0 0
273 729
0 0
152 0
0 0
156 0
6 654
65 0
92 0
949 349
800 0
666 778
69 0
600 78
439 73
846 511
0 0
749 0
0 0
169 0
381 613
453 0
0 0
394 821
205 0
0 0
694 116
154 510
75 567
0 0
705 0
174 395
0 0
491 0
941 35...

output:

1
8609

result:

points 1.0 x = 8609

Test #69:

score: 50
Accepted
time: 5ms
memory: 5404kb

input:

1000 10500
920 0
0 0
0 0
711 0
137 521
512 259
583 0
284 949
757 219
287 0
0 0
0 0
0 0
72 0
273 295
700 443
871 0
0 0
455 0
124 119
900 642
661 0
0 0
821 0
594 0
483 0
733 0
0 0
0 0
0 0
315 174
79 693
0 0
0 0
928 0
136 0
0 0
0 0
698 818
0 0
918 0
170 0
760 0
964 0
0 0
958 0
973 423
0 0
260 94
310 0
...

output:

1
10274

result:

points 1.0 x = 10274