QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#462259#1504. Ideal Cityltunjic100 ✓105ms23080kbC++202.1kb2024-07-03 16:39:172024-07-03 16:39:18

Judging History

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

  • [2024-07-03 16:39:18]
  • 评测
  • 测评结果:100
  • 用时:105ms
  • 内存:23080kb
  • [2024-07-03 16:39:17]
  • 提交

answer

#include <cstdio> 
#include <vector> 
#include <algorithm> 
#include <unordered_map> 

#define X first
#define Y second
#define PB push_back

using namespace std;	

typedef long long ll;
typedef pair<int, int> pii;

struct hsh {
	size_t operator () (const pii &p) const { return hash<ll>() ((ll) p.X) ^ ((ll) p.Y << 32); }
}; 

const int LOG = 17;
const int N = 1 << LOG;
const int MOD = 1e9;

unordered_map<pii, int, hsh> edg, cp;
vector<int> g[N];

ll ans;
ll sz[N], pod[N], sum;

ll dfs(int u, int p) { 
	pod[u] += sz[u];
	for(int v : g[u]) { 
		if(v != p) {
			pod[u] += dfs(v, u); 
		}
	}
	ans += (sum - pod[u]) * pod[u];
	return pod[u];
}

void edge(int u, int v) { 
	if(edg.count({u, v}) || edg.count({v, u})) {
		return;
	}
	edg[{u, v}] = 1;
	g[u].PB(v);
	g[v].PB(u);
//	printf("%d %d\n", u, v);
}

int n;
vector<int> V[N];

void solve(const vector<int> &X, const vector<int> &Y) {
	edg.clear();
	cp.clear();
	edg.reserve(N);
	cp.reserve(N);
	for(int i = 0; i < N; ++i) { 
		V[i].clear();
		g[i].clear();
		sz[i] = 0;
		pod[i] = 0;
	}

	for(int i = 0; i < n; ++i) {
		V[X[i]].PB(Y[i]);
	}

	int cnt = 0;
	for(int x = 0; x < N; ++x) { 
		sort(V[x].begin(), V[x].end());
		int lst = -5;
		for(int y : V[x]) { 
			if(lst + 1 != y) { 
				++cnt;
			}
			cp[{x, y}] = cnt;
//			printf("%d %d : %d\n", x, y, cnt);
			++sz[cnt];
			
			if(cp.count({x - 1, y})) { 
				edge(cnt, cp[{x - 1, y}]);
			}

			lst = y;
		}
	}

	sum = 0;
	for(int i = 1; i <= cnt; ++i) { 
		sum += sz[i];
	}

	dfs(1, 0);
}

vector<int> vx, vy;

int DistanceSum(int nn, int *xx, int *yy) { 
	n = nn;
	for(int i = 0; i < n; ++i) {
		vx.PB(xx[i]);
		vy.PB(yy[i]);
	}

	sort(vx.begin(), vx.end());
	vx.erase(unique(vx.begin(), vx.end()), vx.end());
	sort(vy.begin(), vy.end());
	vy.erase(unique(vy.begin(), vy.end()), vy.end());
	
	vector<int> x, y;
	for(int i = 0; i < n; ++i) { 
		x.PB(lower_bound(vx.begin(), vx.end(), xx[i]) - vx.begin());
		y.PB(lower_bound(vy.begin(), vy.end(), yy[i]) - vy.begin());
	}

	solve(x, y);
	solve(y, x);
	return ans % MOD;
}

詳細信息

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 5ms
memory: 7456kb

input:

11
2 5
2 6
3 3
3 6
4 3
4 4
4 5
4 6
5 3
5 4
5 6

output:

174

result:

ok single line: '174'

Test #2:

score: 11
Accepted
time: 3ms
memory: 8380kb

input:

20
3 5
4 6
2 5
3 4
6 5
1 6
2 7
3 1
2 6
1 5
5 5
5 4
4 7
4 2
3 2
3 3
4 4
4 3
4 5
5 2

output:

691

result:

ok single line: '691'

Test #3:

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

input:

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

output:

198300

result:

ok single line: '198300'

Test #4:

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

input:

20
5 5
4 7
4 5
5 4
4 4
3 3
4 2
4 6
3 2
3 5
2 4
6 5
2 3
1 5
4 1
1 4
4 3
5 3
5 6
3 4

output:

631

result:

ok single line: '631'

Test #5:

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

input:

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

output:

55938

result:

ok single line: '55938'

Test #6:

score: 11
Accepted
time: 5ms
memory: 8272kb

input:

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

output:

41604

result:

ok single line: '41604'

Test #7:

score: 11
Accepted
time: 5ms
memory: 7852kb

input:

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

output:

302886

result:

ok single line: '302886'

Test #8:

score: 11
Accepted
time: 5ms
memory: 7856kb

input:

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

output:

240969

result:

ok single line: '240969'

Test #9:

score: 11
Accepted
time: 2ms
memory: 8620kb

input:

200
10 10
13 16
5 13
27 8
31 5
26 11
6 20
21 14
21 9
13 9
25 6
7 19
19 10
8 12
23 7
8 18
18 9
14 18
4 13
1 14
29 10
30 6
27 11
24 11
18 3
20 3
6 14
14 15
10 18
15 16
12 13
24 17
17 13
3 14
13 18
20 15
25 11
19 3
20 9
22 11
6 11
17 9
8 15
12 12
2 14
29 7
14 9
31 9
26 7
30 10
26 2
19 6
20 6
23 12
16 8...

output:

449939

result:

ok single line: '449939'

Test #10:

score: 11
Accepted
time: 5ms
memory: 8440kb

input:

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

output:

300861

result:

ok single line: '300861'

Test #11:

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

input:

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

output:

199742

result:

ok single line: '199742'

Subtask #2:

score: 21
Accepted

Dependency #1:

100%
Accepted

Test #12:

score: 21
Accepted
time: 0ms
memory: 8916kb

input:

1000
40 32
10 29
25 25
16 59
14 23
12 51
25 43
53 36
14 49
27 41
30 46
42 29
31 43
23 24
8 27
30 40
19 26
33 13
31 45
20 42
18 23
8 51
34 8
21 43
44 14
31 41
37 34
23 41
32 27
18 24
56 20
42 20
11 43
41 15
52 42
22 27
50 42
42 37
51 17
51 39
26 45
14 42
3 47
27 52
42 38
38 21
32 32
5 41
24 20
41 47
...

output:

25293852

result:

ok single line: '25293852'

Test #13:

score: 21
Accepted
time: 0ms
memory: 7828kb

input:

1000
37 83
24 55
36 82
27 64
3 63
12 53
23 78
20 59
31 52
9 71
39 87
32 25
10 74
31 26
24 9
9 65
28 55
13 8
8 68
19 71
7 63
18 70
13 12
30 45
24 24
23 15
14 72
40 83
16 72
41 91
13 71
24 46
27 14
3 60
24 76
26 76
35 83
23 71
13 2
24 31
16 5
45 77
35 77
21 77
6 53
42 89
40 87
20 72
14 15
33 71
41 90
...

output:

33023936

result:

ok single line: '33023936'

Test #14:

score: 21
Accepted
time: 6ms
memory: 8372kb

input:

1500
62 7
45 19
42 46
72 45
35 48
56 16
73 6
8 26
57 35
51 17
49 29
59 50
45 51
52 36
35 18
65 7
39 26
47 61
74 64
64 51
50 34
51 78
63 37
51 29
21 33
47 46
47 42
35 14
58 30
78 60
45 24
59 41
59 77
20 30
39 49
33 37
43 26
66 10
27 31
57 32
40 10
46 43
41 41
55 42
69 11
26 36
65 4
68 69
50 41
14 23
...

output:

80076721

result:

ok single line: '80076721'

Test #15:

score: 21
Accepted
time: 5ms
memory: 7592kb

input:

1500
8 33
64 84
65 66
30 48
63 81
33 43
7 38
37 54
10 27
66 78
32 46
36 43
39 36
13 63
16 34
38 17
21 47
58 82
41 42
18 32
14 24
27 16
69 68
52 60
16 22
50 73
32 19
6 4
63 83
28 51
18 36
22 41
25 50
8 26
56 64
30 41
4 42
24 39
7 37
23 16
36 36
9 43
52 73
35 27
64 65
12 11
41 37
15 52
11 20
68 73
4 2...

output:

108093858

result:

ok single line: '108093858'

Test #16:

score: 21
Accepted
time: 0ms
memory: 9004kb

input:

2000
15 40
38 34
53 73
66 13
4 64
80 24
69 70
52 78
55 67
16 59
90 34
68 49
28 59
73 22
71 68
65 36
78 17
80 44
83 57
57 42
72 7
35 59
47 56
76 39
52 11
41 36
59 64
51 31
74 21
41 79
9 44
61 62
49 21
34 52
51 44
59 27
56 22
59 31
53 66
57 33
26 56
93 40
41 18
54 8
28 32
28 50
64 11
41 58
93 44
18 60...

output:

141161499

result:

ok single line: '141161499'

Test #17:

score: 21
Accepted
time: 6ms
memory: 8652kb

input:

2000
55 157
53 46
54 47
50 133
46 120
56 143
51 130
46 24
48 143
17 13
23 13
49 100
45 161
42 132
56 59
40 76
35 20
52 62
51 78
19 19
44 158
51 39
50 72
49 48
54 160
20 12
43 16
51 159
50 45
48 74
46 29
44 77
49 161
48 34
53 137
51 44
50 156
46 99
51 139
47 140
49 130
44 129
23 10
21 22
58 160
56 39...

output:

192404035

result:

ok single line: '192404035'

Test #18:

score: 21
Accepted
time: 0ms
memory: 7828kb

input:

2000
46 67
103 66
57 38
90 41
45 38
23 76
32 73
50 78
31 6
49 75
4 27
80 89
17 25
60 44
34 71
63 80
73 88
74 94
102 96
94 29
83 88
22 24
84 39
123 52
89 88
92 47
73 91
74 49
48 24
105 45
95 58
60 32
91 90
37 30
104 66
50 22
133 42
107 95
44 68
21 6
13 25
84 91
127 52
106 76
78 37
37 69
56 87
15 19
3...

output:

300871017

result:

ok single line: '300871017'

Test #19:

score: 21
Accepted
time: 0ms
memory: 7852kb

input:

2000
6 48
50 57
40 60
9 51
71 56
13 56
75 53
57 73
8 50
52 55
25 28
83 53
134 54
128 44
59 60
113 39
13 4
94 54
17 17
61 66
117 45
3 46
81 51
29 25
63 64
19 31
5 16
31 23
4 13
55 65
123 67
7 18
123 71
126 62
96 42
20 56
95 54
10 50
128 68
27 30
132 63
96 49
126 77
134 61
11 19
128 51
79 66
44 70
13 ...

output:

237087994

result:

ok single line: '237087994'

Test #20:

score: 21
Accepted
time: 0ms
memory: 8372kb

input:

2000
8 24
20 50
40 36
55 28
48 33
56 32
26 8
26 35
53 40
55 43
54 21
40 18
16 37
65 35
35 56
24 31
28 34
32 47
61 30
26 27
44 55
36 22
11 40
47 34
33 17
26 14
34 61
20 46
46 53
34 12
48 52
47 23
59 39
36 35
22 48
30 25
41 13
14 27
44 22
28 7
24 42
22 31
50 46
40 55
13 23
13 41
22 10
50 20
31 38
55 4...

output:

75161653

result:

ok single line: '75161653'

Test #21:

score: 21
Accepted
time: 6ms
memory: 8256kb

input:

2000
41 65
29 31
58 29
21 33
5 41
53 54
29 9
29 36
56 41
14 24
43 19
19 38
7 27
54 41
27 32
31 35
35 48
8 39
40 3
28 30
36 45
25 10
39 23
60 48
22 31
36 18
43 53
37 62
23 47
33 31
23 12
62 46
50 24
27 51
33 10
33 30
25 49
33 26
44 14
2 37
46 8
25 45
39 4
31 8
45 25
58 20
47 34
19 21
29 10
4 35
16 24...

output:

77866092

result:

ok single line: '77866092'

Subtask #3:

score: 23
Accepted

Test #22:

score: 23
Accepted
time: 9ms
memory: 9896kb

input:

20000
242 212
246 209
138 163
77 67
135 206
142 160
124 180
54 117
165 235
42 107
256 196
185 222
148 186
114 154
169 140
118 151
175 152
67 141
103 75
65 64
76 109
222 201
189 240
84 124
91 65
100 140
228 195
141 211
47 115
198 194
161 198
220 185
127 198
147 141
204 200
151 176
22 117
171 239
137 ...

output:

286235263

result:

ok single line: '286235263'

Test #23:

score: 23
Accepted
time: 14ms
memory: 9492kb

input:

20000
604 26
463 10
533 34
155 22
154 16
471 9
358 17
411 25
287 15
580 35
633 31
472 25
219 26
401 35
312 18
515 31
600 28
684 33
448 34
148 8
393 11
253 12
562 38
37 13
219 23
330 34
623 36
660 26
552 32
208 12
449 11
414 33
599 31
94 13
491 13
528 25
83 4
404 15
296 29
130 5
135 15
51 8
476 14
34...

output:

977619265

result:

ok single line: '977619265'

Test #24:

score: 23
Accepted
time: 25ms
memory: 11972kb

input:

50000
100 221
320 261
166 153
306 246
19 165
239 275
202 297
160 140
225 202
377 321
126 159
259 381
62 182
282 336
215 315
268 335
254 250
201 226
136 6
72 127
187 177
94 107
278 306
143 247
24 155
75 178
295 274
178 163
34 165
281 349
230 258
253 289
70 149
132 208
110 228
118 173
88 202
361 286
1...

output:

479065452

result:

ok single line: '479065452'

Test #25:

score: 23
Accepted
time: 21ms
memory: 13568kb

input:

50000
616 63
653 49
987 50
957 59
333 34
194 8
480 24
521 50
814 30
876 37
507 63
75 3
696 62
612 15
373 27
682 53
116 26
179 39
437 3
548 53
1014 55
534 48
144 39
905 61
97 28
585 20
312 4
709 36
959 59
417 43
628 60
424 5
18 17
577 29
321 24
542 1
556 4
1123 54
429 38
775 62
248 32
381 14
201 35
6...

output:

638764298

result:

ok single line: '638764298'

Test #26:

score: 23
Accepted
time: 49ms
memory: 15652kb

input:

100000
123 221
398 318
182 224
208 37
384 303
97 222
317 332
370 240
188 235
303 259
356 253
522 421
289 418
455 378
248 156
554 436
168 301
140 239
129 169
459 513
332 307
369 409
222 124
215 62
198 74
567 418
153 235
227 347
112 222
279 160
382 445
207 25
331 346
225 152
216 167
329 214
196 230
16...

output:

946624959

result:

ok single line: '946624959'

Test #27:

score: 23
Accepted
time: 45ms
memory: 17640kb

input:

100000
678 13
463 35
382 58
584 24
274 52
219 35
669 28
710 54
1003 34
1065 41
1374 79
643 73
696 67
264 7
1588 81
700 70
305 30
626 7
1431 81
1468 67
737 57
1454 56
723 52
1032 76
1094 65
1387 75
12 21
903 52
500 41
780 76
817 64
1151 75
1444 49
1481 55
766 33
1430 58
1467 70
752 82
447 59
1087 22
...

output:

849740680

result:

ok single line: '849740680'

Test #28:

score: 23
Accepted
time: 34ms
memory: 16456kb

input:

100000
1632 532
1399 311
1452 325
1782 1767
1385 250
1678 630
1210 206
615 162
1537 429
1574 475
1523 360
1327 251
1675 547
1479 274
1682 567
1555 381
1428 243
1465 353
1080 195
1398 256
1617 420
1066 184
1783 1735
1748 1593
1559 443
1508 284
1674 484
1736 885
1605 467
1217 207
1056 177
1093 183
104...

output:

170846850

result:

ok single line: '170846850'

Test #29:

score: 23
Accepted
time: 49ms
memory: 16708kb

input:

100000
236 9
254 170
266 60
11 235
48 183
232 39
268 293
7 155
189 158
254 220
307 214
195 7
199 117
35 21
119 262
91 200
304 133
61 217
109 253
283 268
72 267
166 23
149 35
34 216
62 296
223 73
224 156
260 77
90 247
23 276
252 10
270 146
288 227
282 307
159 321
167 128
280 175
147 191
117 220
38 22...

output:

668194997

result:

ok single line: '668194997'

Test #30:

score: 23
Accepted
time: 43ms
memory: 17256kb

input:

100000
2670 29
215 22
1524 6
2580 6
3008 9
2652 12
2287 10
77 28
1254 20
1704 13
2590 7
186 10
2038 19
2100 26
91 10
2382 5
347 30
2551 24
928 11
2613 21
2201 18
466 25
821 30
1873 28
2436 17
557 2
2079 23
1772 10
127 31
1994 6
1235 20
1801 18
1487 21
2904 8
2122 7
386 22
751 18
1171 18
83 23
1472 2...

output:

955405650

result:

ok single line: '955405650'

Test #31:

score: 23
Accepted
time: 65ms
memory: 23080kb

input:

100000
26015 4
26736 3
10443 3
7730 3
8816 4
24225 4
12147 2
17574 2
15613 4
16724 2
21266 2
5131 2
6901 2
9808 2
13310 2
11349 4
12716 2
16011 2
22258 4
19273 2
10206 4
8501 2
26701 3
11747 2
17337 3
15376 3
20695 4
21013 3
25930 2
23844 2
8643 4
27099 1
25154 1
30617 1
28656 1
18503 1
15774 1
2200...

output:

651220100

result:

ok single line: '651220100'

Subtask #4:

score: 45
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #32:

score: 45
Accepted
time: 19ms
memory: 10248kb

input:

20000
261 239
294 262
100 403
39 426
149 141
97 472
116 428
164 76
69 187
195 410
156 119
190 232
45 193
98 165
110 351
113 57
229 362
112 134
93 164
108 139
145 23
171 419
174 302
136 81
163 316
113 200
181 203
127 307
127 151
268 263
207 390
160 216
145 136
79 171
91 472
201 271
92 437
146 100
127...

output:

623824788

result:

ok single line: '623824788'

Test #33:

score: 45
Accepted
time: 14ms
memory: 11456kb

input:

20000
202 224
36 8
160 573
197 465
263 722
156 574
281 452
208 446
223 222
295 515
204 443
329 623
253 675
180 585
265 730
144 217
160 458
372 528
156 463
417 648
266 679
189 267
207 330
222 626
209 222
285 457
253 265
299 648
265 724
228 656
167 536
410 580
194 535
137 530
298 491
171 534
62 2
275 ...

output:

326947000

result:

ok single line: '326947000'

Test #34:

score: 45
Accepted
time: 40ms
memory: 15008kb

input:

50000
95 409
125 298
301 270
287 255
232 166
113 565
146 456
91 187
335 491
108 413
307 401
240 390
134 503
251 334
219 130
31 304
270 103
72 420
91 467
50 103
145 503
118 14
101 26
230 543
70 396
92 96
139 37
56 187
95 339
262 358
12 321
88 556
308 146
90 538
144 354
310 506
99 182
190 468
319 558
...

output:

900074011

result:

ok single line: '900074011'

Test #35:

score: 45
Accepted
time: 43ms
memory: 13488kb

input:

50000
568 696
300 432
208 62
351 343
577 778
631 750
594 634
365 378
418 368
432 433
614 436
446 418
257 419
581 700
128 71
580 455
158 111
375 367
209 151
412 617
472 668
253 34
470 364
331 507
368 463
23 43
244 447
499 352
543 683
281 243
597 543
362 411
236 460
425 651
226 43
224 129
328 238
494 ...

output:

912437958

result:

ok single line: '912437958'

Test #36:

score: 45
Accepted
time: 96ms
memory: 20952kb

input:

100000
1083 661
118 149
526 438
683 493
764 539
997 617
418 495
885 410
174 122
485 500
446 445
1119 691
799 552
640 492
285 523
295 341
193 59
299 456
1024 602
375 536
405 505
856 426
175 431
205 516
1081 626
501 585
256 533
655 530
300 503
851 629
547 465
871 568
243 579
628 455
257 488
423 424
30...

output:

569855292

result:

ok single line: '569855292'

Test #37:

score: 45
Accepted
time: 63ms
memory: 19288kb

input:

100000
549 719
281 373
416 1207
537 191
429 1129
498 33
588 154
468 469
144 620
181 486
454 454
567 735
440 391
426 404
480 177
19 506
435 1017
711 268
635 293
352 1280
575 120
702 240
356 344
467 394
379 1238
492 937
365 1209
99 545
478 1002
298 511
591 811
456 93
547 401
343 346
96 668
349 311
128...

output:

42469199

result:

ok single line: '42469199'

Test #38:

score: 45
Accepted
time: 105ms
memory: 21908kb

input:

100000
652 281
81 931
666 504
409 572
462 253
589 493
423 585
747 616
474 564
777 545
324 371
563 844
752 8
535 870
546 320
253 454
380 584
507 214
667 649
394 571
734 628
228 411
824 196
348 373
475 581
198 766
272 421
596 518
505 446
665 41
643 545
80 1006
427 223
240 470
188 683
534 691
381 669
5...

output:

664756356

result:

ok single line: '664756356'

Test #39:

score: 45
Accepted
time: 66ms
memory: 17764kb

input:

100000
753 93
255 252
513 268
927 517
913 294
556 587
735 577
698 663
765 644
925 361
531 853
886 515
175 227
627 274
914 489
687 419
46 69
710 130
685 663
972 472
736 594
623 345
471 324
688 236
628 641
575 623
681 134
17 49
769 442
781 755
22 93
783 369
725 88
1086 542
883 297
610 797
737 555
700 ...

output:

559582985

result:

ok single line: '559582985'

Test #40:

score: 45
Accepted
time: 62ms
memory: 17568kb

input:

100000
349 128
252 424
400 189
131 251
315 107
351 361
404 269
222 264
337 288
390 282
278 75
212 307
292 160
174 268
431 272
107 289
165 318
417 267
192 321
366 336
155 335
246 399
232 103
145 364
395 283
306 141
187 264
460 248
343 145
173 315
88 288
106 344
141 274
365 375
94 303
244 294
408 303
...

output:

512944606

result:

ok single line: '512944606'

Test #41:

score: 45
Accepted
time: 61ms
memory: 17160kb

input:

100000
118 212
405 195
308 491
132 225
456 256
419 310
407 428
460 336
328 293
393 355
446 349
61 150
598 374
568 423
89 224
376 289
103 211
443 268
133 290
457 247
57 13
184 221
302 466
531 409
112 187
85 230
530 358
567 346
516 315
377 242
502 364
474 399
134 83
409 281
179 258
185 182
150 370
331...

output:

923337767

result:

ok single line: '923337767'