QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#335525#4078. 지름길hotboy2703100 ✓470ms24744kbC++142.3kb2024-02-23 15:33:422024-02-23 15:33:42

Judging History

This is the latest submission verdict.

  • [2024-02-23 15:33:42]
  • Judged
  • Verdict: 100
  • Time: 470ms
  • Memory: 24744kb
  • [2024-02-23 15:33:42]
  • Submitted

answer

#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#define N_ 250100
using namespace std;

int n, Nxt[N_], R1[N_], L1[N_], R2[N_];
struct point {
	long long x, y;
}P[N_];
long long S[N_], w[N_], Deq[N_][2];
long long Dis(point a, point b) {
	return abs(a.x - b.x) + abs(a.y - b.y);
}

long long Dis2(int a, int b) {
	return S[b - 1] - S[a - 1];
}

bool Pos(long long L) {
	int i, pv = 1;
	for (i = 1; i <= n; i++) {
		while (pv <= n && Dis2(i, pv) <= L)pv++;
		Nxt[i] = pv;
	}

	if (Nxt[1] == n + 1)return true;
	int t1 = Nxt[1];
	for (i = t1; i <= n; i++)R1[i] = i - 1;
	pv = t1;
	for (i = t1 - 1; i >= 1; i--) {
		while (pv <= n && Dis2(t1, pv) + Dis(P[i], P[pv]) + Dis2(1, i) <= L) pv++;
		R1[i] = pv - 1;
	}
	for (i = n; i >= 1; i--)if (Dis2(i, n) > L)break;
	t1 = i;
	for (i = 1; i <= t1; i++)L1[i] = i + 1;
	pv = t1;
	for (i = t1 + 1; i <= n; i++) {
		while (pv >= 1 && Dis2(pv, t1) + Dis(P[pv], P[i]) + Dis2(i, n) <= L)pv--;
		L1[i] = pv + 1;
	}


	pv = 1;

	int pp = 1;

	int head = 1, tail = 0;
	for (i = 1; i <= n; i++) {
		if (pv < i)pv = i;
		while (pv <= n) {
			if (head <= tail && Dis2(i, pv) + Dis(P[i], P[pv]) - Deq[head][0] > L)break;
			pv++;
			if (pv > n)break;
			while (pp <= n && Nxt[pp] <= pv) {
				long long t = Dis2(pp, Nxt[pp]);
				while (head <= tail && Deq[tail][0] >= t)tail--;
				tail++;
				Deq[tail][0] = t, Deq[tail][1] = pp;
				pp++;
			}
		}
		R1[i] = min(R1[i], pv - 1);
		if (head <= tail && Deq[head][1] == i)head++;
	}
	pv = 1;
	for (i = 1; i <= n; i++) {
		R2[i] = i;
		if (pv < i)pv = i;
		while (pv <= n && Dis2(1, i) + Dis(P[i], P[pv]) + Dis2(pv, n) > L)pv++;
		R2[i] = max(R2[i], pv);
	}
	for (i = 1; i <= n; i++) {
		if (R2[i] <= R1[i]) {
			if (L1[R1[i]] <= i) {
				return true;
			}
		}
	}
	return false;
}

long long shortcut(int N, std::vector<long long> X, std::vector<long long> Y) {
	n = N;
	int i;
	for (i = 0; i < n; i++) {
		P[i + 1] = { X[i],Y[i] };
	}
	for (i = 1; i < n; i++) {
		w[i] = Dis(P[i], P[i + 1]);
		S[i] = S[i - 1] + w[i];
	}
	long long bb = 0, ee = S[n - 1], mid, res = S[n - 1];
	while (bb <= ee) {
		mid = (bb + ee) >> 1;
		if (Pos(mid)) {
			res = mid;
			ee = mid - 1;
		}
		else bb = mid + 1;
	}
	return res;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 2ms
memory: 12056kb

input:

40
-840790729 -985003
-815418389 -955293
-813613887 -953180
-809906673 -948839
-765262115 -896562
-760667595 -891182
-706785319 -828088
-702569121 -823151
-457261037 -535905
-369627827 -433290
-362664311 -425136
-305682015 -358412
-224814193 -263719
-22544293 -26869
19320495 22153
44261565 51358
107...

output:

1674425160

result:

ok single line: '1674425160'

Test #2:

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

input:

40
935148 648754858
937127 409230160
945646 5360331
938189 303536525
936237 510402595
937632 357358127
935707 575728283
940401 133801644
948161 80493122
935685 577507173
941969 54880951
942883 25085096
935203 641229236
954063 603999600
941148 91782439
945092 726740
941733 64522026
948395 92137642
94...

output:

4136463678

result:

ok single line: '4136463678'

Test #3:

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

input:

40
-14 -6
2 -6
7 -1
-5 12
7 9
-8 2
-5 -14
-4 6
-1 -9
-10 8
-7 11
4 13
13 12
220375734 361270239
220375751 361270225
220375735 361270242
220375731 361270236
220375751 361270227
220375749 361270239
220375754 361270222
-220375747 -361270220
-220375729 -361270241
-220375732 -361270216
-220375746 -361270...

output:

1163292078

result:

ok single line: '1163292078'

Test #4:

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

input:

34
-4 1
-4 9
-12 -12
-6 8
-10 -1
8 8
9 5
-8 10
-8 -4
3 13
-2 -4
273476957 373194808
273476970 373194816
273476954 373194808
273476966 373194818
273476951 373194825
273476950 373194820
-273476951 -373194815
-273476969 -373194830
-273476961 -373194814
-273476950 -373194814
-273476958 -373194817
8 -5
6...

output:

1293343632

result:

ok single line: '1293343632'

Test #5:

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

input:

40
6 11
-1 -9
-12 12
-3 6
-11 -11
-5 -10
7 0
12 13
11 2
12 8
13 10
11 -1
-5 -8
340523459 313643751
340523475 313643741
340523456 313643739
340523457 313643729
340523460 313643749
340523462 313643755
340523461 313643747
-340523461 -313643748
-340523453 -313643749
-340523452 -313643755
-340523456 -313...

output:

1308334541

result:

ok single line: '1308334541'

Test #6:

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

input:

40
-392514052 -201123473
-392514038 -201123474
-392514037 -201123453
-392514035 -201123462
-392514033 -201123469
-392514033 -201123451
-13 7
-11 -13
-11 -6
-11 9
-10 12
-8 9
-8 10
-7 11
-5 -1
-4 -10
-3 -6
-3 11
-1 3
-1 4
0 -12
0 -9
0 -4
0 2
2 -8
2 12
4 1
4 8
5 4
5 6
7 -11
8 -1
9 11
392514031 2011234...

output:

1187275085

result:

ok single line: '1187275085'

Test #7:

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

input:

40
-315195039 92871074
-315194490 92875058
-315189789 92864110
-315188714 92866041
-315187529 92874191
-315187571 92874663
399160917 570433327
399172801 570437442
399161003 570425216
399173559 570431995
399164890 570441629
399177407 570431465
399172749 570440259
5571654 -110733651
5567684 -110737752...

output:

2399055797

result:

ok single line: '2399055797'

Test #8:

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

input:

22
-704711830 335795271
-704708593 335795813
-704709654 335799852
-283675039 -170961465
-283661973 -170958777
-283675477 -170951611
297942219 -525291813
297929494 -525290438
297927537 -525289005
-420991581 -299176404
-420997008 -299181675
-420989474 -299170508
749890699 -416991144
749884327 -4169829...

output:

3135258827

result:

ok single line: '3135258827'

Test #9:

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

input:

40
-675923384 -313525373
-675916036 -313534803
-675925176 -313539661
-675910401 -313534858
-675921138 -313537453
-675909135 -313525366
-675912160 -313538396
-675925258 -313520904
537219296 192593035
537231424 192593580
537232248 192587953
537232349 192593289
537225087 192590245
537233439 192592922
5...

output:

2263521079

result:

ok single line: '2263521079'

Test #10:

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

input:

40
-671329385 -197095524
-671322189 -197104671
-671321420 -197092524
-671320669 -197095303
-671313695 -197089432
-671309568 -197105274
-193309493 512867080
-193299912 512871648
-193299539 512880681
-193294107 512862360
-193294069 512879558
-193293254 512879414
-168803922 -43792861
-168802092 -437866...

output:

2311297229

result:

ok single line: '2311297229'

Test #11:

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

input:

40
-1000000000 -999999997
999999991 999999999
-1000000000 -999999998
999999995 999999996
-1000000000 -999999999
1000000000 999999993
-999999991 -1000000000
999999999 999999996
-999999990 -999999990
999999993 999999994
-999999994 -999999996
1000000000 999999994
-999999996 -999999998
1000000000 999999...

output:

79999999585

result:

ok single line: '79999999585'

Test #12:

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

input:

40
-797030039 -519597370
-362608705 -63866375
502048997 -879518116
165580186 -403994940
826396844 374647878
-930907488 540398820
-189879546 -873283123
-107280468 -274822024
855567771 -610817159
-338138706 -837295931
558096097 481321988
-136764479 -884246118
-284030287 -709555110
-968390701 -67744380...

output:

26537084312

result:

ok single line: '26537084312'

Test #13:

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

input:

3
-23701303 309013085
-642234447 -793751337
77905484 -674176394

output:

1721297566

result:

ok single line: '1721297566'

Subtask #2:

score: 6
Accepted

Dependency #1:

100%
Accepted

Test #14:

score: 6
Accepted
time: 1ms
memory: 12288kb

input:

100
-385672 -285431265
578412 427990895
-814464 -602737345
806062 596451895
-912458 -675252905
-501248 -370957505
-279158 -206610905
-429351 -317753725
-348026 -257573225
233736 172930655
794747 588078795
287917 213024595
-993211 -735010125
-998954 -739259945
-489200 -362041985
-997240 -737991585
22...

output:

25743732339

result:

ok single line: '25743732339'

Test #15:

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

input:

100
-1663326 -776821
-1542282 -1042485
-1382232 -1264844
-1194117 -1438862
-1174774 -2100129
-1170339 -343527
-1159103 -90018
-1132251 -576866
-1093176 173273
-1052063 -781211
-989373 -1561924
-969340 434794
-938468 -949593
-891189 -2179664
-801207 -1077144
-779443 -1633825
-650629 -1161229
-642562 ...

output:

41864406

result:

ok single line: '41864406'

Test #16:

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

input:

100
-19 -12
19 18
12 -4
15 -16
-21 6
-14 1
-15 7
-16 1
-1 -21
-17 18
16 -16
-5 -2
-14 19
-13 -2
7 -10
-8 -9
11 12
-5 11
-8 7
8 2
-13 22
-7 -15
4 9
-13 8
20 -16
14 -13
-12 12
6 -7
22 6
1 -6
18 -1
2 9
22 -20
384179393 346608341
384179399 346608351
384179426 346608358
384179413 346608366
384179415 3466...

output:

1461575892

result:

ok single line: '1461575892'

Test #17:

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

input:

98
-12 -3
15 14
2 -9
8 -13
0 3
9 -2
15 12
-19 -5
-20 0
-12 -18
-16 19
10 6
13 19
17 -12
11 21
-1 -6
-10 10
-1 -7
1 -10
3 -4
-9 -10
3 10
-20 -4
-15 5
18 -13
-9 -14
6 -18
-10 -7
10 -5
15 17
-10 -11
1 -14
301965289 270827374
301965287 270827365
301965293 270827369
301965283 270827361
301965284 27082737...

output:

1145585710

result:

ok single line: '1145585710'

Test #18:

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

input:

100
-13 -14
7 -10
-14 -2
0 -10
-9 21
9 -16
-9 -7
7 -12
0 21
0 10
17 11
-5 9
-7 3
17 16
3 -16
2 1
14 2
7 20
-10 17
-15 -21
7 -16
4 2
5 13
8 16
2 -16
1 -10
2 -11
-14 1
2 21
-9 1
17 17
-7 7
-16 -10
300975360 280109888
300975349 280109891
300975375 280109918
300975349 280109903
300975344 280109898
30097...

output:

1162171029

result:

ok single line: '1162171029'

Test #19:

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

input:

100
-266050232 -243883853
-266050231 -243883856
-266050226 -243883848
-266050222 -243883859
-266050221 -243883871
-266050221 -243883846
-266050218 -243883852
-266050217 -243883860
-266050209 -243883844
-266050206 -243883848
-266050203 -243883836
-266050200 -243883843
-266050199 -243883854
-266050196...

output:

1019868390

result:

ok single line: '1019868390'

Test #20:

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

input:

100
-218008055 -719710377
-218021508 -719709747
-218008454 -719719631
-218019404 -719708121
-218007872 -719711103
-218020579 -719727732
-218021796 -719720239
-218021300 -719723064
-218013361 -719720472
-218012103 -719723304
-218017489 -719719371
-218012089 -719714832
-218002403 -719721553
-218008025...

output:

2996891258

result:

ok single line: '2996891258'

Test #21:

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

input:

79
596320914 -150981382
596321866 -150984708
596327472 -150974944
596334906 -150976631
596323761 -150974180
596333005 -150980516
596326260 -150985658
596322680 -150978556
596338462 -150970469
596333729 -150981312
596333805 -150970439
596333122 -150976542
596323642 -150972117
-19984022 -743758952
-19...

output:

3647782994

result:

ok single line: '3647782994'

Test #22:

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

input:

100
681061502 785681863
681069224 785682246
681069806 785687240
681067790 785686341
681073018 785687658
681072563 785683210
681066491 785697614
681075775 785697146
681066262 785680080
681070767 785698876
681067303 785686342
681075651 785689045
681077533 785690063
681065991 785681406
681077578 785688...

output:

2486621539

result:

ok single line: '2486621539'

Test #23:

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

input:

100
-478827390 536849662
-478825554 536848898
-478825103 536855417
-478821640 536855091
-478821412 536851999
-478820738 536855912
-478819622 536842833
-478817367 536842582
-478816648 536856450
-478815331 536844604
-478815013 536856910
-478813463 536847497
-478808399 536854921
-384520390 -389033877
-...

output:

2500054396

result:

ok single line: '2500054396'

Test #24:

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

input:

100
-999999997 -999999992
999999989 999999988
-999999995 -999999997
999999991 999999996
-999999991 -999999997
999999999 999999999
-999999989 -999999997
999999999 999999998
-999999990 -999999991
999999997 1000000000
-999999993 -999999999
999999990 999999999
-1000000000 -999999999
999999994 999999990
...

output:

199999998799

result:

ok single line: '199999998799'

Test #25:

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

input:

100
-704412473 -19611009
-882854246 -652703847
526083836 966978902
625644881 262154514
803044871 977812781
-374168236 206437247
453275285 938215081
-535283035 -7283620
-267367418 -599435321
2066156 -1742322
142638547 742022619
-305277319 118076399
546780227 442434459
-765032890 833839851
-891606072 ...

output:

66074310945

result:

ok single line: '66074310945'

Subtask #3:

score: 12
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #26:

score: 12
Accepted
time: 2ms
memory: 12024kb

input:

300
959175 907084359
393353 372382569
-303493 -286136901
-452891 -427318011
-705601 -666128961
736101 696279429
85929 81866889
510879 483444639
819235 774841059
-972872 -918700056
537136 508257504
147509 140059989
708182 669895974
-448213 -422897301
545578 516235194
583154 551744514
698205 660467709...

output:

96717464910

result:

ok single line: '96717464910'

Test #27:

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

input:

300
60379131 -55248661
60113481 -53170354
60042319 -52750844
59873285 -51869552
59681711 -51006361
59668319 -50950115
58222401 -46456129
58066535 -46081778
57509909 -44845684
57202691 -44219966
56617122 -43116763
56392462 -42720401
56157741 -42320306
55201255 -40818078
54919732 -40410030
54840624 -4...

output:

123261567

result:

ok single line: '123261567'

Test #28:

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

input:

300
48239025 98811640
48234558 99174189
48180751 100989880
47733602 106199229
47659506 106758631
47460307 108104258
47317759 108961994
46712620 112005672
46704932 112039862
46683668 112133935
46253574 113910379
46155839 114285068
45789819 115611945
45331554 117132536
45227524 117459475
45092867 1178...

output:

251638068

result:

ok single line: '251638068'

Test #29:

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

input:

300
259259 -88518881
248643 -10749359
252024 -27360210
213315 -293197998
233983 -26927064
242187 -201817
246515 -4197478
219095 -189988305
267780 -205227335
226842 -86638643
215896 -244242603
230126 -55005583
252640 -31200886
255055 -48673364
237835 -8781579
253779 -38965462
230173 -54595276
265379 ...

output:

13886557197

result:

ok single line: '13886557197'

Test #30:

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

input:

300
101944323 158372240
101944346 158372246
101944341 158372244
101944327 158372236
101944319 158372197
101944316 158372234
101944354 158372220
101944299 158372246
101944360 158372198
101944328 158372217
101944356 158372227
101944356 158372193
101944339 158372209
101944350 158372217
101944321 158372...

output:

520640200

result:

ok single line: '520640200'

Test #31:

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

input:

300
-179983550 -140982756
-179983549 -140982758
-179983548 -140982719
-179983548 -140982707
-179983547 -140982750
-179983547 -140982730
-179983546 -140982720
-179983545 -140982720
-179983545 -140982698
-179983544 -140982730
-179983544 -140982718
-179983544 -140982693
-179983543 -140982748
-179983543...

output:

641935757

result:

ok single line: '641935757'

Test #32:

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

input:

300
32 -2
-35 7
-29 -29
-18 0
17 -17
-11 -2
7 -15
9 30
10 30
-4 12
-19 19
-8 4
23 -34
21 -6
-15 31
9 8
3 19
22 31
-7 -30
-13 1
-8 -21
31 18
9 7
2 29
-11 35
-25 27
28 0
-7 13
-33 -10
8 22
-30 16
-18 -27
11 -8
24 35
28 22
1 35
26 34
-23 -5
-7 17
5 -4
-18 22
-14 -3
-32 16
20 30
33 22
10 -10
22 -4
24 -8...

output:

1130666597

result:

ok single line: '1130666597'

Test #33:

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

input:

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

output:

1240506672

result:

ok single line: '1240506672'

Test #34:

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

input:

300
-26 17
-14 35
-29 -34
4 -22
-28 -5
19 15
36 -3
-29 27
6 -27
-23 29
13 -6
-16 -14
-10 -10
-26 -7
25 11
12 -6
13 -17
-8 -33
18 30
19 -13
6 14
29 -2
-22 1
25 -19
-32 -25
-30 31
21 16
-25 21
14 -9
17 -35
-26 -19
15 -32
13 -22
31 9
-17 22
20 -10
-21 30
0 -15
-9 24
-13 -10
-15 -22
9 -32
-22 17
-4 4
-3...

output:

1175765602

result:

ok single line: '1175765602'

Test #35:

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

input:

300
-360073548 -396026498
-360073544 -396026521
-360073542 -396026550
-360073542 -396026542
-360073541 -396026509
-360073539 -396026562
-360073537 -396026517
-360073534 -396026507
-360073530 -396026519
-360073528 -396026544
-360073527 -396026544
-360073526 -396026544
-360073526 -396026542
-360073525...

output:

1512201109

result:

ok single line: '1512201109'

Test #36:

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

input:

300
20 -12
-24 16
-2 19
-14 -25
33 -18
4 -31
1 7
33 3
22 -22
13 -20
13 29
-19 20
34 0
24 -22
-32 22
27 34
34 14
-11 9
27 13
0 3
-22 -23
15 -34
9 -22
-31 3
-34 10
-22 -27
27 -33
16 25
27 14
-33 -31
30 17
12 -10
12 -23
20 11
16 23
21 17
5 -23
-33 2
3 19
7 5
-30 -12
32 9
-16 -28
34 -14
15 -13
-9 -11
-6...

output:

987882130

result:

ok single line: '987882130'

Test #37:

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

input:

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

output:

1191636091

result:

ok single line: '1191636091'

Test #38:

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

input:

300
-8 -10
-23 6
-8 -25
-25 26
-27 -26
29 -17
29 25
1 -22
-1 -28
5 -29
27 10
33 -7
-23 -34
-29 22
-27 -21
5 -13
-14 20
-4 -8
-3 -25
28 28
-3 -12
1 -21
-17 -21
29 11
18 12
27 25
-26 -30
-23 -36
17 -22
32 26
-8 11
12 -11
-1 29
-6 -21
2 26
18 8
31 -29
-36 -32
-5 36
-5 -6
1 -33
2 -21
-23 -9
24 -29
-23 5...

output:

1553178953

result:

ok single line: '1553178953'

Test #39:

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

input:

300
-330819817 -307415138
-330819814 -307415164
-330819813 -307415147
-330819811 -307415168
-330819810 -307415125
-330819806 -307415133
-330819806 -307415100
-330819804 -307415165
-330819804 -307415113
-330819799 -307415140
-330819799 -307415120
-330819798 -307415104
-330819797 -307415157
-330819794...

output:

1276470986

result:

ok single line: '1276470986'

Test #40:

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

input:

300
-362274780 -341102287
-362282686 -341090925
-362278285 -341089931
-362271757 -341091543
-362275258 -341095651
-362281494 -341095745
-362277256 -341088712
-362279226 -341092737
-362274367 -341092923
-362278378 -341100969
-362279102 -341106457
-362267409 -341101383
-362274053 -341100451
-362277288...

output:

2390012824

result:

ok single line: '2390012824'

Test #41:

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

input:

187
-476753996 334282862
-476742033 334266843
-476753483 334277428
-476753790 334265086
-476754420 334282352
-476751566 334275998
-476740177 334280024
-476745644 334284572
-476753447 334271917
-476750355 334277260
-476739389 334274663
-476750520 334271280
-476755664 334273449
-476738168 334271914
-4...

output:

4757056588

result:

ok single line: '4757056588'

Test #42:

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

input:

300
23680207 -90767913
23686975 -90752983
23680561 -90771327
23688484 -90755164
23682342 -90769762
23673701 -90766600
23678868 -90752598
23686226 -90754602
23671280 -90771745
23673956 -90760047
23689517 -90768204
23686885 -90768846
23686574 -90762066
23672539 -90763451
23682783 -90753357
23690633 -9...

output:

3117581384

result:

ok single line: '3117581384'

Test #43:

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

input:

300
-613165544 -424641723
-613165108 -424651569
-613164377 -424641375
-613163376 -424648029
-613163296 -424649333
-613162816 -424652422
-613162809 -424649401
-613162133 -424647131
-613161919 -424638800
-613160745 -424636386
-613160638 -424637066
-613160425 -424635962
-613159720 -424638322
-613159594...

output:

2154584640

result:

ok single line: '2154584640'

Test #44:

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

input:

300
63027415 309908866
918511171 -934392464
63027416 160185004
918511171 760307537
63027415 -830868407
918511173 333549121
63027415 -129328497
918511172 -473406109
63027416 101047444
918511171 -896799753
63027415 604693815
918511173 -843583246
63027414 -206429050
918511171 590089137
63027416 -509130...

output:

227719969130

result:

ok single line: '227719969130'

Test #45:

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

input:

165
512897883 7773998
21922427 310474955
512897885 -517880363
21922426 -212866589
512897883 429234656
21922426 749045030
512897884 -477033944
21922426 496535429
512897885 -395405565
21922426 833648345
512897884 -408429622
21922426 170181265
512897884 -28851425
21922427 676552727
512897884 -128661011...

output:

90427826934

result:

ok single line: '90427826934'

Test #46:

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

input:

300
-866778144 495919789
-327417563 -406422260
-866778146 390974369
-327417565 -410697742
-866778145 132560150
-327417564 220755748
-866778145 579633543
-327417565 -467307012
-866778145 -848074046
-327417563 -758188383
-866778144 451311277
-327417563 507678456
-866778145 -329749219
-327417565 -57665...

output:

183315493257

result:

ok single line: '183315493257'

Test #47:

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

input:

300
-839209322 -995157744
-839209322 -953047815
-839209322 -920464929
-839209322 -916301115
-839209322 -916085869
-839209322 -858091521
-839209322 -833338336
-839209322 -799681682
-839209322 -767344454
-839209322 -766318871
-839209322 -757246620
-839209322 -740900174
-839209322 -636143689
-839209322...

output:

10655946276

result:

ok single line: '10655946276'

Test #48:

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

input:

300
-999999983 -999999993
999999995 999999997
-999999983 -999999987
999999991 999999990
-999999988 -999999991
999999988 999999999
-999999996 -999999990
999999986 999999995
-999999988 -1000000000
999999982 999999985
-999999991 -999999994
999999990 999999991
-999999994 -999999993
999999992 1000000000
...

output:

599999994317

result:

ok single line: '599999994317'

Test #49:

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

input:

300
478159291 -52091812
431124352 -87063693
421711715 -877390566
-882297509 663242500
386794887 845506970
-240577734 -645829794
-825549284 -903524744
149904641 646749926
-190185504 973479274
926992787 -894559221
-445359171 380988601
-126200400 542020735
755202628 566249958
-387498922 500622007
98353...

output:

201864765303

result:

ok single line: '201864765303'

Test #50:

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

input:

300
-995340405 -434377471
-990645562 281004208
-988524547 318213424
-986546457 753467527
-984873733 -889200740
-977444437 -592714296
-975628734 303548882
-975281149 358944319
-974249506 753284529
-971510325 457123532
-967452904 -552472253
-949974565 532858183
-946633763 -162074510
-943918763 -449979...

output:

99830124860

result:

ok single line: '99830124860'

Subtask #4:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #51:

score: 25
Accepted
time: 2ms
memory: 12056kb

input:

2000
-997680 484445355
-994799 483048070
-992081 481729840
-991659 481525170
-987719 479614270
-986467 479007050
-985850 478707805
-984864 478229595
-984715 478157330
-982541 477102940
-981956 476819215
-981870 476777505
-981803 476745010
-980720 476219755
-980699 476209570
-979385 475572280
-978438...

output:

970864218

result:

ok single line: '970864218'

Test #52:

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

input:

2000
62838123 -85829176
62837717 -85675196
62836685 -85471384
62836498 -85442216
62836443 -85435269
62836328 -85418988
62835847 -85354315
62826751 -84641812
62823720 -84479414
62822278 -84407933
62808224 -83835515
62806304 -83768977
62805881 -83754581
62804445 -83706531
62803598 -83678377
62797835 -...

output:

297828140

result:

ok single line: '297828140'

Test #53:

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

input:

2000
-59754051 5046836
-59444523 -2164870
-58282922 -9226549
-58153083 5141968
-57866259 -1881605
-57763643 -16695680
-57591006 12210841
-56749384 -8759177
-56552348 5224343
-56300530 -16038786
-56286713 -1611031
-56173452 19221918
-55991426 12103798
-55213070 -8304256
-54951919 5293970
-54915218 -2...

output:

29138716453

result:

ok single line: '29138716453'

Test #54:

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

input:

2000
32787415 -73520242
32787645 -73434484
32787788 -73635124
32787792 -73411415
32788147 -73366738
32788229 -73358263
32788287 -73352543
32788442 -73707819
32788595 -73324944
32788616 -73722907
32788711 -73730020
32788760 -73311670
32789380 -73778341
32790132 -73822998
32790224 -73218135
32790475 -...

output:

10038993492

result:

ok single line: '10038993492'

Test #55:

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

input:

2000
101291601 190567218
101291615 190567149
101291729 190567073
101291668 190567157
101291710 190567126
101291762 190567152
101291637 190567139
101291601 190567124
101291679 190567118
101291694 190567161
101291669 190567188
101291779 190567148
101291606 190567166
101291629 190567214
101291757 19056...

output:

583834919

result:

ok single line: '583834919'

Test #56:

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

input:

2000
-148177930 -108517019
-148177930 -108516980
-148177929 -108516941
-148177928 -108517044
-148177928 -108516972
-148177928 -108516907
-148177927 -108517051
-148177927 -108517040
-148177927 -108517038
-148177927 -108517006
-148177927 -108516973
-148177927 -108516968
-148177927 -108516901
-14817792...

output:

513430926

result:

ok single line: '513430926'

Test #57:

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

input:

2000
21 73
-3 -30
-81 -49
-20 24
80 47
22 -19
77 -49
4 22
-87 55
61 -53
81 -22
45 -9
-42 -19
-82 66
21 -75
7 43
-62 -47
-5 52
-67 -56
58 53
69 -68
-21 -1
-51 62
8 -67
-31 54
-83 -18
-55 47
32 -84
-63 -19
-59 14
-79 79
-7 -89
63 -46
-50 -81
49 -23
-66 -7
60 78
-44 -74
-30 -63
5 37
-23 68
3 -3
32 -19
...

output:

1403892252

result:

ok single line: '1403892252'

Test #58:

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

input:

1368
30 -21
-64 -31
-18 1
7 8
74 50
-11 72
71 -32
18 -27
9 -71
-45 62
-3 -12
-3 -34
71 -26
-50 -5
-57 60
45 -2
57 32
27 67
-60 -36
-4 14
13 -40
51 54
-62 -56
-67 23
48 69
-31 72
-48 73
-27 37
38 34
-43 56
68 -40
-40 42
71 2
38 -38
-25 60
30 21
-59 -53
-18 -64
38 68
-37 39
54 -66
42 -19
-52 -41
66 33...

output:

1086025646

result:

ok single line: '1086025646'

Test #59:

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

input:

2000
44 -40
76 -38
-3 56
5 67
47 -39
-49 -79
-60 -81
44 45
-18 72
-68 8
27 -68
38 17
6 -72
-8 30
20 -12
-79 -14
69 8
-78 -78
-52 -17
-17 9
-82 32
13 48
91 -42
-17 52
41 -77
-59 -76
74 -3
78 -9
62 -3
-36 79
-12 60
-68 37
13 -88
40 68
75 -83
19 -35
-43 -27
21 -65
5 77
-73 -8
51 -82
-89 -50
44 27
-51 -...

output:

993466708

result:

ok single line: '993466708'

Test #60:

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

input:

2000
-390521952 -285553178
-390521951 -285553164
-390521950 -285553185
-390521950 -285553183
-390521950 -285553172
-390521950 -285553083
-390521949 -285553044
-390521948 -285553147
-390521948 -285553013
-390521947 -285553171
-390521947 -285553135
-390521947 -285553132
-390521947 -285553029
-39052194...

output:

1352169762

result:

ok single line: '1352169762'

Test #61:

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

input:

2000
8 -8
60 -66
1 31
-89 -80
-56 16
13 39
31 -28
87 -36
-42 28
-5 73
50 24
32 61
66 48
10 -53
-66 36
-86 -65
52 42
24 64
12 -57
-3 21
-73 -28
74 -1
16 -37
-62 -57
52 48
43 -43
-22 -10
-33 81
67 -87
36 1
39 17
72 62
29 -26
-67 -23
-82 82
26 84
1 -56
68 65
-46 -78
-60 -8
75 -19
-50 39
-34 44
43 -21
5...

output:

1214111466

result:

ok single line: '1214111466'

Test #62:

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

input:

925
53 55
35 -6
48 17
-51 -50
-9 56
23 -34
-4 4
-31 48
-53 -56
-39 -24
18 3
-13 -18
34 -5
42 21
56 -49
11 10
-59 -35
40 43
-41 -6
-18 41
-38 -32
-15 54
51 -17
24 52
-40 -8
-21 -23
9 10
-59 -16
33 -31
4 49
28 -60
58 -42
4 46
40 23
1 -22
4 -20
17 17
-19 6
55 17
8 36
-29 49
35 -26
25 -53
56 -23
52 -21
...

output:

1254711861

result:

ok single line: '1254711861'

Test #63:

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

input:

2000
-61 -64
-63 24
-77 -1
63 -6
-25 -50
67 63
-62 -20
45 8
-21 -56
-77 78
-75 67
-15 17
-78 33
-83 82
-59 62
-56 -37
-15 -48
-17 37
71 -68
59 -42
41 -63
-21 -24
-32 -22
-41 1
90 14
37 37
54 -8
-14 -80
-6 66
90 -62
-69 54
33 -74
-90 -6
0 -5
-48 -47
-57 7
24 -62
64 71
56 -48
44 -22
-58 77
30 6
21 -20...

output:

1477861271

result:

ok single line: '1477861271'

Test #64:

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

input:

2000
-266243975 -274962891
-266243975 -274962885
-266243973 -274962974
-266243973 -274962958
-266243973 -274962860
-266243973 -274962859
-266243972 -274962959
-266243972 -274962945
-266243971 -274962907
-266243971 -274962850
-266243970 -274962870
-266243969 -274962878
-266243969 -274962820
-26624396...

output:

1082432324

result:

ok single line: '1082432324'

Test #65:

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

input:

2000
-770404864 -604906271
-770412852 -604912327
-770407927 -604907828
-770415220 -604917166
-770414212 -604914295
-770411996 -604898666
-770408076 -604901119
-770404580 -604911294
-770419173 -604909990
-770413459 -604911831
-770419198 -604915822
-770417848 -604916067
-770409500 -604917628
-77040974...

output:

4179111789

result:

ok single line: '4179111789'

Test #66:

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

input:

1012
-402381052 743746895
-402375791 743757894
-402383609 743745160
-402385936 743755305
-402391835 743753094
-402379387 743753270
-402376946 743749079
-402376886 743753475
-402389812 743743161
-402379112 743744622
-402386920 743753801
-402388943 743750213
-402378479 743745776
-402390938 743749044
-...

output:

3166253224

result:

ok single line: '3166253224'

Test #67:

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

input:

2000
-631567868 -727437030
-631566928 -727431204
-631567217 -727439095
-631558025 -727423991
-631572361 -727432949
-631575544 -727433919
-631568780 -727433803
-631560185 -727435278
-631571431 -727438652
-631565505 -727434474
-631568969 -727431817
-631567204 -727433469
-631575929 -727438040
-63156518...

output:

5629517888

result:

ok single line: '5629517888'

Test #68:

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

input:

2000
-484718307 -66762559
-484718301 -66778121
-484718254 -66761815
-484718236 -66766438
-484718230 -66774663
-484718218 -66769787
-484718161 -66780030
-484718151 -66775150
-484718109 -66775234
-484718093 -66771100
-484718025 -66762989
-484717901 -66777801
-484717885 -66771618
-484717876 -66778960
-...

output:

1469143126

result:

ok single line: '1469143126'

Test #69:

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

input:

2000
364533609 -139744278
-300605781 839609781
364533607 -122834958
-300605780 666535245
364533607 -548915240
-300605781 447129462
364533607 423210389
-300605781 433654148
364533609 350914496
-300605779 -619955221
364533608 -774112618
-300605779 -310657384
364533608 -19485496
-300605780 358336714
36...

output:

1324771156891

result:

ok single line: '1324771156891'

Test #70:

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

input:

1569
255746649 -665420701
-955428493 390260217
255746651 756692019
-955428493 -611229255
255746649 -132812687
-955428493 -414551660
255746649 966476940
-955428493 -120785116
255746650 -773766834
-955428494 -613023693
255746650 -895546880
-955428493 -644348079
255746650 -352691500
-955428494 -9990561...

output:

1463997178648

result:

ok single line: '1463997178648'

Test #71:

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

input:

2000
-623154961 805676961
-831708240 -890523320
-623154960 -849766170
-831708240 837048073
-623154959 -121951064
-831708240 -513121232
-623154960 -412817764
-831708240 410194941
-623154959 956684373
-831708240 -599635546
-623154959 438499425
-831708240 -846587061
-623154960 477451244
-831708239 9215...

output:

879272410878

result:

ok single line: '879272410878'

Test #72:

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

input:

2000
-627020717 -993272914
-627020717 -986320739
-627020717 -984418335
-627020717 -981175755
-627020717 -976561142
-627020717 -975856789
-627020717 -972202508
-627020717 -970273056
-627020717 -964154997
-627020717 -951733130
-627020717 -948431465
-627020717 -945673892
-627020717 -943888689
-62702071...

output:

10915323300

result:

ok single line: '10915323300'

Test #73:

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

input:

2000
-999999969 -999999990
999999992 999999968
-999999988 -999999996
999999982 999999965
-999999999 -999999974
999999969 999999974
-999999994 -999999970
999999968 999999978
-999999989 -999999968
999999984 999999997
-999999983 -999999993
999999993 999999964
-999999986 -999999996
999999990 999999968
-...

output:

3999999927452

result:

ok single line: '3999999927452'

Test #74:

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

input:

2000
-390297264 479987512
-508720519 -387928195
564508681 -873347996
-79209168 536908590
107198495 281676441
540283553 909728753
816849574 927955695
-98547520 -581573286
-871646796 467308323
472029122 164332996
840457579 196048194
-903287278 401521402
-599886610 -373887174
-746688352 -878320067
-359...

output:

1311797755294

result:

ok single line: '1311797755294'

Test #75:

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

input:

2000
-999748385 -751589049
-996146249 973563994
-993534805 -928780737
-993220334 199330330
-992563114 341251834
-991184055 246384928
-989246499 -650255958
-987281813 951886817
-987147293 432314294
-987064508 143425186
-985652607 -614466238
-984886780 -142906444
-984393925 -678948628
-981330121 -5302...

output:

661308320800

result:

ok single line: '661308320800'

Test #76:

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

input:

2000
-612509844 -318410799
-454887289 -189845846
427812731 -4799563
392632563 -766637220
-452469679 35763580
269605126 894239123
745687402 -21587212
481079760 -873909337
-590333400 -481915989
605814987 -424644682
-823537219 -528986
41218952 -102481269
-712543549 332331667
844748617 -751123587
-94250...

output:

1372598156446

result:

ok single line: '1372598156446'

Subtask #5:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #77:

score: 40
Accepted
time: 90ms
memory: 13472kb

input:

50000
274965150 784364
-169519100 -485591
-187131450 -535912
-17765750 -52010
315327150 899684
-208863650 -598004
-132639250 -380220
343037000 978855
-303231000 -867625
322471350 920096
-222946600 -638241
105622900 300529
103319900 293949
-307734800 -880493
72442550 205728
143325950 408252
-10903560...

output:

5830730733672

result:

ok single line: '5830730733672'

Test #78:

score: 0
Accepted
time: 51ms
memory: 15376kb

input:

50000
-268270 -208944
-264114 -206751
-261039 -202572
-259741 -196862
-260743 -190301
-264339 -183719
-270534 -178016
-279051 -174088
-289332 -172720
-300570 -174524
-311776 -179851
-321858 -188748
-329715 -200929
-334324 -215781
-334858 -232388
-330748 -249586
-321766 -266051
-308065 -280390
-29019...

output:

879422540219

result:

ok single line: '879422540219'

Test #79:

score: 0
Accepted
time: 87ms
memory: 13588kb

input:

50000
226493 606996723
223117 195275533
211537 512942361
226682 637921603
211617 501972165
214924 142959529
214769 154842172
225201 422499918
217258 20880166
212068 440099479
219189 2430407
210011 754813353
228453 951795279
224788 370028803
212834 344451528
210565 661456812
224690 359160409
212582 3...

output:

8232951099080

result:

ok single line: '8232951099080'

Test #80:

score: 0
Accepted
time: 83ms
memory: 11600kb

input:

50000
135723 107898487
135085 117320992
162044 67721952
152815 2899663
144787 15792632
134117 132649906
142211 33571251
135895 105386596
153931 6202670
159421 40608508
155622 13614198
154862 9937318
159147 38194229
148147 2549715
143780 21952372
152247 1682207
158446 32289079
133756 138611680
154700...

output:

1667712422025

result:

ok single line: '1667712422025'

Test #81:

score: 0
Accepted
time: 55ms
memory: 15700kb

input:

50000
164074807 176357534
164074771 176356951
164074725 176357496
164074074 176357318
164074596 176357246
164074802 176357363
164074466 176357259
164074526 176357330
164074368 176357356
164074446 176357758
164074615 176357303
164074684 176357010
164074047 176357382
164074397 176357522
164073925 1763...

output:

695828697

result:

ok single line: '695828697'

Test #82:

score: 0
Accepted
time: 39ms
memory: 13460kb

input:

50000
-168091135 -139017566
-168091135 -139017306
-168091135 -139017230
-168091135 -139017015
-168091134 -139017876
-168091134 -139017872
-168091134 -139017848
-168091134 -139017846
-168091134 -139017834
-168091134 -139017777
-168091134 -139017741
-168091134 -139017725
-168091134 -139017712
-1680911...

output:

615713591

result:

ok single line: '615713591'

Test #83:

score: 0
Accepted
time: 32ms
memory: 13460kb

input:

50000
-344 -91
374 -429
22 -104
199 306
-91 -2
239 329
431 -218
-3 -9
-417 -212
-439 -123
37 -195
-321 -75
-412 -113
-155 -10
290 412
-379 -39
-15 87
117 -123
-28 -389
-391 46
28 358
-95 333
90 -189
84 363
-42 -346
-117 -18
-444 -21
-426 101
117 264
210 8
-232 -118
243 35
-352 -146
-16 100
-47 394
1...

output:

1262544844

result:

ok single line: '1262544844'

Test #84:

score: 0
Accepted
time: 15ms
memory: 12168kb

input:

18716
-111 -210
218 -148
-125 154
-3 24
-266 -99
-162 122
7 -196
249 63
-191 129
235 165
-159 228
-225 150
-171 -132
-263 226
-31 238
46 -269
211 -205
274 -35
-25 -33
-80 104
78 -27
-203 259
269 10
269 247
143 -163
-203 23
-172 -76
69 -173
70 6
-216 64
-170 78
-73 -149
-81 -200
161 212
-215 29
-190 ...

output:

1390314248

result:

ok single line: '1390314248'

Test #85:

score: 0
Accepted
time: 33ms
memory: 15768kb

input:

50000
382 21
319 433
246 -122
-311 -196
271 21
-245 -204
195 391
196 -116
-309 204
-174 315
212 139
148 20
437 -21
103 -379
239 -418
-266 402
356 396
-382 286
-197 -395
-260 159
107 -37
-15 -440
-89 156
-267 152
-310 79
-198 -151
332 -279
349 -399
407 -162
-189 -153
186 85
345 -360
99 377
-197 336
-...

output:

1250543891

result:

ok single line: '1250543891'

Test #86:

score: 0
Accepted
time: 28ms
memory: 13724kb

input:

50000
-294363603 -324213699
-294363603 -324213379
-294363603 -324212972
-294363602 -324213648
-294363602 -324213607
-294363602 -324213485
-294363602 -324213384
-294363602 -324213270
-294363602 -324213267
-294363602 -324213145
-294363601 -324213768
-294363601 -324213657
-294363601 -324213607
-2943636...

output:

1238416476

result:

ok single line: '1238416476'

Test #87:

score: 0
Accepted
time: 37ms
memory: 13400kb

input:

50000
-409 209
-288 198
74 -206
-92 -284
-413 349
249 426
118 -44
398 -265
-283 -167
167 -437
190 149
-99 -300
-87 88
237 -253
16 -422
130 215
159 -422
448 -300
-106 315
-423 -232
308 71
-340 -230
-199 281
354 -366
-372 398
-259 430
-367 257
391 58
340 -266
-386 -317
-150 380
-328 -149
425 -27
384 -...

output:

1049223053

result:

ok single line: '1049223053'

Test #88:

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

input:

20635
-11 88
-15 -82
-80 -242
245 121
34 277
221 123
172 254
-139 170
-280 -143
-220 -135
-51 212
242 -218
189 -269
141 224
-122 38
-48 -125
54 236
-253 186
162 -12
-284 -33
-187 -205
166 88
66 78
-132 108
-221 -59
-146 255
193 -165
-179 -205
-271 258
-37 258
25 11
-23 183
-66 69
215 -139
-66 -169
7...

output:

1267626116

result:

ok single line: '1267626116'

Test #89:

score: 0
Accepted
time: 34ms
memory: 13452kb

input:

50000
-424 -388
248 -43
75 18
20 177
-82 347
304 70
243 206
366 -394
-65 -63
-241 -226
-103 -389
-20 -49
-91 314
233 -357
-5 436
-36 -93
321 290
-423 -305
-252 -228
154 385
250 -421
-345 -256
-426 -234
-53 431
9 192
-48 36
158 -126
-158 147
-63 346
54 216
-29 299
-427 -239
310 210
-331 -23
398 354
-...

output:

1415620238

result:

ok single line: '1415620238'

Test #90:

score: 0
Accepted
time: 33ms
memory: 13464kb

input:

50000
-356155050 -319886928
-356155050 -319886921
-356155050 -319886690
-356155049 -319887420
-356155049 -319887333
-356155049 -319887141
-356155049 -319886917
-356155049 -319886687
-356155048 -319887419
-356155048 -319887287
-356155048 -319887235
-356155048 -319887138
-356155048 -319887129
-3561550...

output:

1353339170

result:

ok single line: '1353339170'

Test #91:

score: 0
Accepted
time: 34ms
memory: 13488kb

input:

50000
14090692 -94664251
14085239 -94663360
14092193 -94670395
14093663 -94660314
14093304 -94659664
14087275 -94675435
14087030 -94675788
14086770 -94677954
14088989 -94658781
14103339 -94666141
14094083 -94660150
14091299 -94673455
14103773 -94664599
14098186 -94676434
14099388 -94666347
14090432 ...

output:

3466150458

result:

ok single line: '3466150458'

Test #92:

score: 0
Accepted
time: 16ms
memory: 12192kb

input:

19810
380575790 -598477311
380571461 -598476243
380574232 -598471029
380583729 -598471321
380567245 -598485053
380580711 -598472688
380578391 -598475441
380585274 -598484198
380579830 -598474865
380575911 -598474068
380577235 -598466712
380576637 -598481949
380576065 -598479588
380582386 -598479705
...

output:

3083459425

result:

ok single line: '3083459425'

Test #93:

score: 0
Accepted
time: 48ms
memory: 15688kb

input:

50000
-180586555 235962800
-180573058 235963941
-180573806 235959263
-180583141 235971597
-180571223 235971590
-180576919 235963077
-180575360 235960244
-180576923 235961124
-180588779 235960830
-180583468 235973208
-180574805 235960527
-180580749 235973038
-180571218 235965556
-180573200 235974999
...

output:

2193853459

result:

ok single line: '2193853459'

Test #94:

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

input:

50000
-400674679 -46767046
-400674678 -46755194
-400674677 -46768301
-400674675 -46767584
-400674675 -46761589
-400674675 -46753534
-400674675 -46749176
-400674674 -46749559
-400674672 -46748755
-400674671 -46763371
-400674671 -46758427
-400674671 -46751890
-400674668 -46754304
-400674667 -46760725
...

output:

2482280980

result:

ok single line: '2482280980'

Test #95:

score: 0
Accepted
time: 62ms
memory: 13432kb

input:

50000
-902626597 213196720
946324236 -82573333
-902626596 -807128422
946324236 -204950733
-902626596 271782320
946324236 -645935285
-902626595 -114775333
946324236 -631098137
-902626597 818670859
946324234 -494689521
-902626597 591590212
946324236 -548548727
-902626596 -628923826
946324234 332659783...

output:

62922280571612

result:

ok single line: '62922280571612'

Test #96:

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

input:

12873
-44083159 -395211134
-114171903 790463226
-44083160 731880153
-114171903 -921638188
-44083159 889210380
-114171903 43713352
-44083158 373679588
-114171904 -121098002
-44083158 923886570
-114171903 275188446
-44083160 263647408
-114171904 -259871512
-44083160 57272760
-114171904 278684772
-4408...

output:

4814753053501

result:

ok single line: '4814753053501'

Test #97:

score: 0
Accepted
time: 91ms
memory: 13436kb

input:

50000
902824708 209618366
990640582 872974439
902824708 -443866578
990640582 -594772353
902824708 720385903
990640581 -73561405
902824707 -406748436
990640582 920868749
902824707 157382640
990640581 869623792
902824706 -348260728
990640581 -124519754
902824708 602379650
990640581 -155251379
90282470...

output:

18807811996529

result:

ok single line: '18807811996529'

Test #98:

score: 0
Accepted
time: 39ms
memory: 13588kb

input:

50000
-763872768 -999998330
-763872768 -999557650
-763872768 -999339902
-763872768 -999168477
-763872768 -999016606
-763872768 -998823495
-763872768 -998781991
-763872768 -998690024
-763872768 -998580068
-763872768 -998373432
-763872768 -998082065
-763872768 -998039121
-763872768 -997912111
-7638727...

output:

10643902625

result:

ok single line: '10643902625'

Test #99:

score: 0
Accepted
time: 52ms
memory: 15976kb

input:

50000
-999999891 -999999922
999999856 999999969
-999999869 -999999964
999999948 999999842
-999999951 -999999942
999999994 999999906
-999999876 -999999986
999999840 999999937
-999999853 -999999847
999999913 999999866
-999999837 -999999879
999999881 999999940
-999999939 -999999855
999999955 999999966
...

output:

99999991799776

result:

ok single line: '99999991799776'

Test #100:

score: 0
Accepted
time: 87ms
memory: 13544kb

input:

50000
-664670749 190837361
-897176360 -980483021
-921798677 -289268516
546238041 -58232420
-390681582 675476524
282370465 382833718
-316926661 -905418050
597907484 446226714
-674613814 -590229975
967508019 736654465
661301050 -995976350
537361219 654470793
-952505129 120304980
752842060 -657228985
-...

output:

33329473552323

result:

ok single line: '33329473552323'

Test #101:

score: 0
Accepted
time: 91ms
memory: 13340kb

input:

50000
-999973082 175495973
-999858571 -394678232
-999829226 -293571775
-999815130 277774909
-999765029 -427245192
-999705256 -99605091
-999685084 885496031
-999679107 849952224
-999525669 -688539729
-999494176 664699888
-999453395 -534232729
-999395713 611028829
-999337674 340568945
-999247787 19440...

output:

16676467127588

result:

ok single line: '16676467127588'

Test #102:

score: 0
Accepted
time: 84ms
memory: 13380kb

input:

50000
582360470 -755866943
-540427777 -271667449
-936573178 135632528
-230593067 323786124
-649508097 -305705094
-658165813 -362224293
622242978 318625311
-460888031 -190092607
-78959506 -276675473
890713042 -460656603
-68477328 -591880994
-292346875 -888542830
391286447 -487386510
-885410636 -69424...

output:

33157621329542

result:

ok single line: '33157621329542'

Subtask #6:

score: 13
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #103:

score: 13
Accepted
time: 141ms
memory: 24448kb

input:

250000
-999995 414258834
-999985 414254684
-999974 414250119
-999973 414249704
-999954 414241819
-999937 414234764
-999934 414233519
-999921 414228124
-999907 414222314
-999894 414216919
-999893 414216504
-999889 414214844
-999887 414214014
-999886 414213599
-999885 414213184
-999872 414207789
-9998...

output:

831996256

result:

ok single line: '831996256'

Test #104:

score: 0
Accepted
time: 455ms
memory: 24460kb

input:

250000
-975560345 -38687300
-975256857 -43201799
-974932481 -47714316
-974587232 -52224759
-974221118 -56733031
-973834154 -61239031
-973426355 -65742669
-972997731 -70243846
-972548299 -74742466
-972314088 25662237
-972308665 21154614
-972298612 30170362
-972282352 16647587
-972262234 34678892
-972...

output:

55434513759111

result:

ok single line: '55434513759111'

Test #105:

score: 0
Accepted
time: 219ms
memory: 23388kb

input:

250000
354025 800000246
354026 799840252
354026 800000243
354028 799520317
354028 799680273
354028 799680280
354028 799680281
354028 799840255
354028 800000245
354029 799520312
354029 799680273
354029 799840250
354029 800000245
354029 800000250
354030 799360370
354030 799520314
354030 799520319
3540...

output:

14630390153

result:

ok single line: '14630390153'

Test #106:

score: 0
Accepted
time: 466ms
memory: 24500kb

input:

250000
-581841 652217447
-579939 382418253
-566430 537435297
-570245 123551941
-567382 407043689
-575697 37519378
-580526 458328694
-582088 694055306
-573720 16504
-566976 460633386
-573650 114182
-583320 914318133
-582299 728632654
-570408 112224688
-571943 32978247
-564074 938379384
-566337 550415...

output:

41752746232490

result:

ok single line: '41752746232490'

Test #107:

score: 0
Accepted
time: 277ms
memory: 24628kb

input:

250000
110904416 162914544
110905019 162915737
110904119 162914484
110904720 162915465
110903625 162914155
110904648 162914573
110903247 162914125
110904786 162915695
110903514 162914430
110904993 162914278
110904717 162914373
110903333 162914160
110903911 162914753
110903406 162915410
110903168 162...

output:

714604909

result:

ok single line: '714604909'

Test #108:

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

input:

250000
-144565872 -183368658
-144565872 -183368557
-144565872 -183368495
-144565872 -183368479
-144565872 -183368356
-144565872 -183368347
-144565872 -183367983
-144565872 -183367966
-144565872 -183367912
-144565872 -183367887
-144565872 -183367749
-144565872 -183367634
-144565872 -183367556
-144565...

output:

663637962

result:

ok single line: '663637962'

Test #109:

score: 0
Accepted
time: 181ms
memory: 24176kb

input:

250000
205 646
892 -781
-224 699
15 628
-72 -826
-607 -864
669 -496
-542 533
-898 96
-746 188
289 -871
779 373
320 267
685 574
-515 819
-223 -386
247 -867
540 881
-688 -807
18 713
-33 241
842 -599
-872 -953
816 -931
701 504
-154 -380
-697 914
-213 -269
-786 -77
649 -454
621 -296
316 -869
-332 -216
-...

output:

1122548942

result:

ok single line: '1122548942'

Test #110:

score: 0
Accepted
time: 37ms
memory: 12140kb

input:

58933
-337 179
-418 -259
467 -62
249 -256
154 -194
-25 -362
-184 113
38 -100
-194 -342
-398 -225
2 166
-52 -120
461 -183
-240 -190
-188 -201
-341 -306
-179 132
-309 487
-107 289
393 -357
-201 -271
185 -340
-292 -227
297 -197
356 368
-131 -247
-120 -377
-350 459
342 211
239 388
322 -263
129 478
257 1...

output:

1450472859

result:

ok single line: '1450472859'

Test #111:

score: 0
Accepted
time: 185ms
memory: 22824kb

input:

250000
-780 9
816 -362
-714 788
143 -792
-916 -746
-13 -417
-601 971
130 647
333 -35
107 -597
-706 -603
-898 -530
300 -772
909 740
25 -667
23 -677
825 -332
142 44
-211 602
179 -382
744 -158
218 725
36 546
-419 -52
-652 530
601 -675
220 -291
-342 22
-915 -300
-834 154
719 -791
566 406
-620 52
149 724...

output:

1096639931

result:

ok single line: '1096639931'

Test #112:

score: 0
Accepted
time: 155ms
memory: 23244kb

input:

250000
-306644267 -268257278
-306644267 -268256815
-306644267 -268256529
-306644267 -268256524
-306644267 -268256396
-306644267 -268256294
-306644267 -268255921
-306644267 -268255907
-306644266 -268257277
-306644266 -268257213
-306644266 -268257059
-306644266 -268256921
-306644266 -268256881
-306644...

output:

1157041678

result:

ok single line: '1157041678'

Test #113:

score: 0
Accepted
time: 185ms
memory: 22884kb

input:

250000
576 -869
-545 -55
-200 735
-716 -649
576 -560
453 693
182 273
375 -748
416 601
-933 584
992 988
538 509
490 -616
962 -313
-290 369
336 996
-773 -464
427 48
-760 671
-646 -629
-608 16
-966 -243
493 775
530 -733
615 -44
-64 598
31 451
337 473
-54 896
482 -957
485 -289
-199 -568
-54 -292
13 -10
...

output:

1530233378

result:

ok single line: '1530233378'

Test #114:

score: 0
Accepted
time: 46ms
memory: 16020kb

input:

65311
-292 100
-328 84
-94 -428
-188 260
131 -9
-10 333
326 218
444 347
-128 460
504 -74
-375 -505
-80 -198
-168 430
-348 -472
237 -267
-212 -266
-397 494
-202 -410
-347 8
488 -440
58 -126
331 -415
161 414
-129 164
-468 121
350 -81
446 -73
121 13
22 313
379 234
-307 -133
200 364
90 -66
-501 -306
-47...

output:

1274607296

result:

ok single line: '1274607296'

Test #115:

score: 0
Accepted
time: 176ms
memory: 24744kb

input:

250000
837 -644
-755 444
397 258
-463 264
279 408
185 -970
-621 -654
-685 -562
-541 -682
496 -104
371 322
660 -940
-982 581
-858 -236
-541 -580
-479 217
831 248
15 -507
834 -134
-537 181
-999 -182
-641 -269
909 810
-414 467
521 -912
-885 -640
-849 -959
951 38
575 -324
669 -200
884 -561
935 -826
-894...

output:

1262442810

result:

ok single line: '1262442810'

Test #116:

score: 0
Accepted
time: 152ms
memory: 24408kb

input:

250000
-379666771 -256655720
-379666771 -256655696
-379666771 -256655185
-379666771 -256655073
-379666771 -256654985
-379666771 -256654858
-379666771 -256654525
-379666771 -256654264
-379666771 -256653922
-379666770 -256655391
-379666770 -256655377
-379666770 -256655369
-379666770 -256655012
-379666...

output:

1279907313

result:

ok single line: '1279907313'

Test #117:

score: 0
Accepted
time: 232ms
memory: 24180kb

input:

250000
-249331810 -256046842
-249326487 -256041819
-249318383 -256040435
-249331242 -256032466
-249318232 -256031367
-249321030 -256043453
-249332334 -256044161
-249320706 -256033089
-249327174 -256031692
-249321709 -256041885
-249313805 -256036387
-249315261 -256034675
-249318794 -256046909
-249331...

output:

3246404415

result:

ok single line: '3246404415'

Test #118:

score: 0
Accepted
time: 41ms
memory: 13592kb

input:

52427
395086569 430186617
395089587 430182616
395088674 430187033
395086489 430188347
395086743 430192515
395099395 430188562
395086222 430186507
395092413 430186219
395091275 430188133
395103673 430189163
395096715 430201372
395090202 430196039
395089025 430193601
395084021 430193559
395092918 4301...

output:

3055331622

result:

ok single line: '3055331622'

Test #119:

score: 0
Accepted
time: 212ms
memory: 23436kb

input:

250000
-483658502 690846212
-483670128 690837317
-483656236 690851393
-483661577 690842019
-483664177 690843783
-483666248 690846271
-483667687 690849858
-483664983 690849964
-483657448 690837324
-483667252 690848282
-483662042 690835939
-483663164 690850271
-483662026 690836886
-483667665 690855078...

output:

6491162568

result:

ok single line: '6491162568'

Test #120:

score: 0
Accepted
time: 198ms
memory: 23876kb

input:

250000
-769066716 -19491076
-769066716 -19483396
-769066714 -19495112
-769066714 -19492781
-769066714 -19482332
-769066714 -19477998
-769066713 -19492267
-769066712 -19485802
-769066712 -19483663
-769066711 -19487043
-769066711 -19480393
-769066710 -19479865
-769066710 -19478788
-769066709 -19491873...

output:

2720938773

result:

ok single line: '2720938773'

Test #121:

score: 0
Accepted
time: 433ms
memory: 23948kb

input:

250000
-282342385 -331886522
-625013290 -869490809
-282342384 792714148
-625013288 -962664524
-282342385 -244341341
-625013290 76213072
-282342385 -147600056
-625013289 117610678
-282342384 -387439663
-625013289 59836288
-282342385 602013850
-625013289 -933710978
-282342383 -882206146
-625013290 -52...

output:

126128813563830

result:

ok single line: '126128813563830'

Test #122:

score: 0
Accepted
time: 95ms
memory: 13960kb

input:

64783
282573938 -231253975
-548855154 159255731
282573937 244090681
-548855153 935569008
282573938 757554325
-548855153 871865903
282573939 104268463
-548855153 -958244865
282573938 421848012
-548855152 -578843534
282573937 -123986572
-548855152 -822406958
282573937 29120566
-548855153 975771005
282...

output:

48535111210621

result:

ok single line: '48535111210621'

Test #123:

score: 0
Accepted
time: 370ms
memory: 23876kb

input:

250000
-161079247 107375536
-909080242 624145587
-161079246 -46761400
-909080242 -435086284
-161079246 -700340986
-909080242 787221497
-161079246 -689197121
-909080242 44246492
-161079245 -810132716
-909080241 -941544291
-161079247 617208427
-909080240 699042259
-161079245 814610628
-909080240 76161...

output:

176561701894013

result:

ok single line: '176561701894013'

Test #124:

score: 0
Accepted
time: 207ms
memory: 24492kb

input:

250000
405793789 -999996755
405793789 -999967323
405793789 -999928731
405793789 -999921748
405793789 -999892369
405793789 -999876934
405793789 -999818853
405793789 -999736569
405793789 -999635652
405793789 -999618249
405793789 -999519148
405793789 -999473544
405793789 -999399695
405793789 -999301823...

output:

10100444431

result:

ok single line: '10100444431'

Test #125:

score: 0
Accepted
time: 266ms
memory: 24708kb

input:

250000
-999999849 -999999685
999999718 999999960
-999999792 -999999768
999999805 999999959
-999999955 -999999998
999999756 999999777
-999999984 -999999903
999999858 999999757
-999999871 -999999739
999999696 999999647
-999999799 -999999943
999999653 999999904
-999999751 -999999980
1000000000 99999982...

output:

499999909334514

result:

ok single line: '499999909334514'

Test #126:

score: 0
Accepted
time: 448ms
memory: 24556kb

input:

250000
-960587968 -903927628
358567798 -235527084
-404461867 -249597976
-264273307 174091982
-842397785 336901954
-52751469 -927322241
-812383433 932546417
-864185121 -246774033
121677832 66989249
597274336 -924898039
188457877 -148511311
416053552 351844894
-232185519 -240840214
-233926366 78183469...

output:

166765408488074

result:

ok single line: '166765408488074'

Test #127:

score: 0
Accepted
time: 470ms
memory: 24200kb

input:

250000
-999990065 -743502959
-999974297 -75797586
-999968418 -376936996
-999965829 -161975768
-999960772 -81347038
-999953781 149200028
-999953625 100446691
-999939314 355912459
-999929389 678655567
-999926960 502862790
-999916749 865843384
-999901748 281660498
-999894876 -120725476
-999871661 48207...

output:

83339509099396

result:

ok single line: '83339509099396'

Test #128:

score: 0
Accepted
time: 452ms
memory: 22844kb

input:

250000
-30779572 278574821
619597287 -446235050
-746436289 -929984182
-906542190 -256989700
740105185 605576384
19586852 850990632
17957376 535576498
-587371433 115987554
-907480131 740841008
707388097 -707755207
525786282 -8329702
-171543485 319565932
-172694752 -468795068
-895807969 -661974704
-12...

output:

166738683615384

result:

ok single line: '166738683615384'