QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#554581#8707. Jobsnfls_vjudge100 ✓123ms43868kbC++142.2kb2024-09-09 12:25:542024-09-09 12:25:54

Judging History

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

  • [2024-09-09 12:25:54]
  • 评测
  • 测评结果:100
  • 用时:123ms
  • 内存:43868kb
  • [2024-09-09 12:25:54]
  • 提交

answer

// Hydro submission #66de78ce73d92a7adbef7e53@1725855950521
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 300005
#define inf 0x3f3f3f3f3f3f3f3f

// monster hunter order
int n,s,fa[maxn];
pii a[maxn],aa[maxn];

pii operator +(pii a,pii b){
	return mkp(max(a.fi,b.fi-a.se),a.se+b.se);
}
bool cmp(pii a,pii b){
	if((a.fi<a.se+a.fi)!=(b.fi<b.se+b.fi))return a.fi<a.se+a.fi;
	return a.fi<a.se+a.fi?a.fi<b.fi:a.se+a.fi>b.se+b.fi;
}

int ff[maxn];
int getf(int x){
	while(x!=ff[x])x=ff[x]=ff[ff[x]];
	return x;
}

pii tr[maxn<<2];
int id[maxn<<2];
void up(int p){
	if(cmp(tr[p<<1],tr[p<<1|1]))tr[p]=tr[p<<1],id[p]=id[p<<1];
	else tr[p]=tr[p<<1|1],id[p]=id[p<<1|1];
}
void build(int p,int l,int r){
	if(l==r)return tr[p]=a[l],id[p]=l,void();
	int mid=l+r>>1;
	build(p<<1,l,mid),build(p<<1|1,mid+1,r),up(p);
}
void mdf(int p,int l,int r,int x){
	if(l==r)return tr[p]=a[l],void();
	int mid=l+r>>1;
	x<=mid?mdf(p<<1,l,mid,x):mdf(p<<1|1,mid+1,r,x);up(p); 
}

void upd(int u){
	int f=getf(fa[u]);
	//cout<<"u: "<<u<<endl;
	//cout<<"f: "<<f<<"\n";
	assert(getf(u)==u);
	assert(getf(f)==f);
	assert(a[f].se!=-inf);
	a[f]=a[f]+a[u];
	ff[u]=f;
	a[u]=mkp(0,-inf);
//	cout<<"a[f] "<<a[f].fi<<" "<<a[f].se<<"\n";
	if(f!=1) mdf(1,2,n,f);
	mdf(1,2,n,u);
}

signed main()
{
	n=read(),s=read();
	a[1]=mkp(0,0);
	For(i,2,n+1){
		int x=read();
		fa[i]=read()+1;
		if(x>=0) a[i]=mkp(0,x);
		else x=-x,a[i]=mkp(x,-x);
	}
	++n;
	For(i,1,n)ff[i]=i;
	build(1,2,n);
	int res=0;
	For(_,2,n){
		int u=id[1];
		upd(u);
		u=getf(1);
	//	cout<<u<<" "<<a[u].fi<<" "<<a[u].se<<"\n";
		if(a[u].fi<=s) res=max(res,a[u].se);
	}
	cout<<res;
	return 0;
}

详细

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 107ms
memory: 41816kb

input:

299955 1000000000000000000
-2 0
10 1
-9 2
14 3
-11 4
17 5
-21 6
22 7
-22 8
23 9
-41 10
-89 10
49 11
99 12
-120 14
-23 8
130 15
24 16
-51 13
55 19
-144 20
-24 18
-30 18
-54 13
64 24
-105 14
145 21
-60 20
-183 25
61 28
-334 30
340 31
111 26
-135 33
-184 33
191 35
-231 17
-505 27
-570 32
-257 25
238 37...

output:

551168

result:

ok single line: '551168'

Test #2:

score: 11
Accepted
time: 103ms
memory: 43652kb

input:

299932 1000000000000000000
-26 0
-38 0
-521 0
-567 0
-569 0
-235 0
-294 0
-134 0
144 8
-177 0
-458 0
-9675 9
296 7
-15 0
34 1
-21349 9
-15643 9
-280 0
-445 15
-13253 13
-7497 15
-12328 15
-3131 15
7498 21
-172566 24
-14287 13
-24726 13
-1 0
-12603 13
-14221 13
-401 0
-4105 13
-2872 15
-1264 9
-5095 ...

output:

797403

result:

ok single line: '797403'

Test #3:

score: 11
Accepted
time: 100ms
memory: 41724kb

input:

299978 1000000000000000000
-319087 0
-397343 0
-746276 0
-123466 0
-27323 0
-462189 0
-44293 0
-157047 0
-492663 0
-471747 0
-214986 0
-276045 0
-134544 0
-245003 0
-564286 0
-100579 0
-128044 0
-725767 0
-317957 0
-515861 0
-209544 0
-152961 0
-275236 0
-499829 0
-609630 0
-439399 0
-61718 0
-80829...

output:

822051

result:

ok single line: '822051'

Test #4:

score: 11
Accepted
time: 89ms
memory: 43680kb

input:

295612 1000000000000000000
-59435628 0
-94130 0
98375 2
-101252 3
-376825783 3
376834010 5
59435737 1
110079 4
-107471 8
-142894643 8
123353 9
-125578 11
-205705873 11
142895079 10
205719702 13
128238 12
-563917506 16
563929915 17
-129566 16
139278 19
-134538 20
-146413129 20
145442 21
-150271 23
15...

output:

963990158

result:

ok single line: '963990158'

Test #5:

score: 11
Accepted
time: 75ms
memory: 43740kb

input:

294609 1000000000000000000
-14859 0
-6241 0
28010 1
-35056 3
-18753 3
29895 5
37233 4
-45266 7
15101 2
46739 8
-42054 7
-47262 10
-47937 10
44830 11
59665 13
48681 12
-49712 15
53835 17
-61975 15
67471 19
-66656 20
-73226 20
78369 21
80156 22
-92090 24
97049 25
-95094 26
-85272 24
100554 27
89857 28...

output:

931886923

result:

ok single line: '931886923'

Test #6:

score: 11
Accepted
time: 69ms
memory: 31020kb

input:

189644 1000000000000000000
-98837 0
119840 1
-99489 2
-76401 0
128492 3
116250 4
-96744 6
-99996 5
133521 8
-99952 5
135918 10
-99998 9
-99991 11
112238 12
-585552 14
-123819 14
601536 15
165067 16
143777 13
-1401938 18
114098 7
-99847 21
-846458 17
-552575 18
141499 22
589263 24
-99993 25
-152653 1...

output:

552691392

result:

ok single line: '552691392'

Test #7:

score: 11
Accepted
time: 105ms
memory: 43656kb

input:

299926 1000000000000000000
-57 0
-15 0
-46 0
-55 0
48 3
-169 5
-8 0
177 6
-4865 8
-4422 8
-1012 8
-1923 8
-2220 8
-2564 8
-8023 8
-11744 8
-9739 8
-3532 8
59 4
-7231 8
-427 19
-3318 19
1930 12
-1325 19
-1522 19
-39876 23
-1074 8
-3767 19
3327 22
8024 15
-1385 8
-3305 19
-162944 29
-83345 29
-62607 2...

output:

794592

result:

ok single line: '794592'

Test #8:

score: 11
Accepted
time: 106ms
memory: 41740kb

input:

299977 1000000000000000000
-84323754 0
-757801297 0
-933618002 0
-354897565 0
-199261474 0
-299459024 0
-206406371 0
-36684345 0
-168861756 0
-578610640 0
-268385541 0
-351312602 0
-97363859 0
-196857332 0
-322636524 0
-95194265 0
-680308843 0
-263260235 0
-216910835 0
-226788267 0
-233048009 0
-814...

output:

986969150

result:

ok single line: '986969150'

Test #9:

score: 11
Accepted
time: 70ms
memory: 41656kb

input:

283319 1000000000000000000
-573197 0
573199 1
-39356 0
39360 3
-282938 4
282944 5
-80826 4
80835 7
-85277 8
-311032 8
85286 9
-91485 11
311035 10
-726938 11
91495 12
-120788 15
-98729 15
98735 17
-99389 18
99396 19
120793 16
726946 14
-741076 20
-99753 20
99761 24
741077 23
-99764 25
99765 27
-29131...

output:

660263

result:

ok single line: '660263'

Test #10:

score: 11
Accepted
time: 72ms
memory: 43776kb

input:

299669 1000000000000000000
-4 0
12 1
-5 0
14 3
-10 4
14 5
-19 6
-24 6
27 7
-6 4
11 10
26 8
-31 12
-28 12
40 13
36 14
-33 15
40 17
-32 15
-46 18
37 19
-39 18
52 20
-50 23
46 22
57 24
-48 23
57 27
-52 26
56 29
-54 26
57 31
-55 32
58 33
-59 32
61 35
-60 36
-66 36
67 37
76 38
-125 40
134 41
-127 42
-132...

output:

793816

result:

ok single line: '793816'

Test #11:

score: 11
Accepted
time: 102ms
memory: 43656kb

input:

299996 1000000000000000000
-12777 0
-184 0
-8243 0
22287 1
15966 3
-29966 5
-115395 4
-25952 4
-35816 4
118906 7
-302894 10
-250742 10
-83569 5
26201 8
44836 9
-112875 15
-236247 14
-154710 14
165906 18
-114324 15
118743 20
-2025587 19
-248790 19
-33062 5
-3472669 21
114363 16
-256645 19
-507672 26
...

output:

986246181

result:

ok single line: '986246181'

Test #12:

score: 11
Accepted
time: 86ms
memory: 31512kb

input:

249970 1000000000000000000
-36928 0
48799 1
-82473 2
-41129 2
-19478 0
47428 4
32207 5
-120777 7
-252259 6
-96443 2
104504 10
-35270 7
-129100 11
-23517 7
-14394 0
142053 13
26675 14
19207 15
-62133 18
-182436 17
-370084 16
188317 20
-285963 6
-63379 17
62790 19
-15725 18
19585 26
-135446 27
-167110...

output:

790209900

result:

ok single line: '790209900'

Test #13:

score: 11
Accepted
time: 113ms
memory: 43772kb

input:

299996 1000000000000000000
-24857 0
-4919 0
34879 1
-38885 0
8630 2
-65139 3
72225 6
-19591 5
-17376 5
20527 9
-85966 7
-191052 7
25119 8
-83197 10
-50123 10
55745 4
-336750 3
-311589 5
208267 12
-2731640 19
-109591 16
86325 11
-2777378 22
84779 14
-350471 13
-71154 16
-1510191 24
-1732689 24
174340...

output:

742832227

result:

ok single line: '742832227'

Subtask #2:

score: 14
Accepted

Test #14:

score: 14
Accepted
time: 0ms
memory: 11852kb

input:

17 5
-3 0
4 1
-4 2
9 3
-5 4
13 5
-6 6
8 7
-23 8
28 9
-26 10
31 11
-28 12
33 13
-39 14
41 15
-7 16

output:

16

result:

ok single line: '16'

Test #15:

score: 14
Accepted
time: 0ms
memory: 11876kb

input:

17 1
-14 0
21 1
-15 2
16 3
-22 4
29 5
-32 6
34 7
-33 8
35 9
-10 10
-1 0
6 12
-3 13
5 14
-16 15
22 16

output:

7

result:

ok single line: '7'

Test #16:

score: 14
Accepted
time: 1ms
memory: 11764kb

input:

17 4
-4 0
12 1
-5 0
8 3
-13 0
17 5
-38 6
39 7
-3 8
-6 0
12 10
-29 11
35 12
-32 13
39 14
-24 0
31 16

output:

42

result:

ok single line: '42'

Test #17:

score: 14
Accepted
time: 2ms
memory: 11872kb

input:

1998 100000
-119974094 0
120949782 1
-148267915 2
149258545 3
-353200332 4
353781482 5
-409351160 0
410180396 7
-405293412 0
405638769 9
-491561775 0
492142804 11
-38208552 0
38786890 13
-188326000 0
188960234 15
-294174444 16
294530806 17
-430597876 18
431035538 19
-487343715 20
487438668 21
-17231...

output:

33581034

result:

ok single line: '33581034'

Test #18:

score: 14
Accepted
time: 1ms
memory: 11740kb

input:

1996 100000
-59755 0
151138 1
-174993 2
255152 3
-257624 4
322787 5
-293552 6
392535 7
-350940 8
418275 9
-487611 10
515476 11
-507579 12
556319 13
-549422 14
556127 15
-584293 16
638017 17
-613793 18
628801 19
-653479 20
704157 21
-695266 22
732277 23
-727516 24
792824 25
-781086 26
819574 27
-8098...

output:

23781881

result:

ok single line: '23781881'

Test #19:

score: 14
Accepted
time: 0ms
memory: 13872kb

input:

1996 83074
-104912 0
157516 1
-226832 2
244272 3
-236577 4
251249 5
-345494 6
411376 7
-527443 8
582958 9
-583787 10
665523 11
-681920 12
727305 13
-730788 14
757169 15
-844569 16
893388 17
-871493 18
916618 19
-1019572 20
1118628 21
-1135127 22
1163326 23
-1294857 24
1367717 25
-1345986 26
1391230 ...

output:

48888408

result:

ok single line: '48888408'

Test #20:

score: 14
Accepted
time: 0ms
memory: 11864kb

input:

1997 392026
-368613 0
553533 1
-8120957 2
8333895 3
-7985911 4
3312802 5
4435825 6
18517 7
-1014196 8
-10212556 9
11612664 10
-13466519 11
14039962 12
-21043407 13
21174643 14
-21449184 15
22266444 16
-31562006 17
31769754 18
-33458430 19
33563104 20
-34071074 21
34188004 22
-34242437 23
34307017 24...

output:

423307544

result:

ok single line: '423307544'

Test #21:

score: 14
Accepted
time: 1ms
memory: 11880kb

input:

1998 3670
-4263584 0
4318213 1
-4766861 2
4793818 3
-6021755 4
6028915 5
-10981412 6
11043466 7
-14917467 8
14928380 9
-18108504 10
18125244 11
-23575827 12
23586895 13
-24056708 14
24132173 15
-25452036 16
25510395 17
-36702348 18
36770088 19
-37159186 20
37165482 21
-38084372 22
38124010 23
-40075...

output:

30157547

result:

ok single line: '30157547'

Test #22:

score: 14
Accepted
time: 1ms
memory: 11868kb

input:

1996 100000
-47319305 0
47364706 1
-13725945 0
13780218 3
-24704817 4
24745187 5
-44323181 0
44421117 7
-5595173 0
5676261 9
-16802773 10
16822863 11
-8972006 0
8976861 13
-4882300 0
4967180 15
-19353494 16
19362861 17
-7345443 0
7410858 19
-21922402 20
21943524 21
-28082838 22
28092936 23
-41738649...

output:

28784257

result:

ok single line: '28784257'

Test #23:

score: 14
Accepted
time: 1ms
memory: 11868kb

input:

1996 954331
-246525934 0
246824973 1
-171768374 0
171931727 3
-277027442 4
277822284 5
-309469868 6
309597847 7
-285885388 8
-122289714 9
408353344 10
-449147475 11
449304397 12
-99137909 0
99891216 14
-388030661 15
388769528 16
-441565178 17
441709887 18
-53104970 0
53516386 20
-153117624 21
153153...

output:

39368059

result:

ok single line: '39368059'

Test #24:

score: 14
Accepted
time: 2ms
memory: 11956kb

input:

1996 1
-1 0
934596 1
-245994 2
838558 3
-1023435 4
1505077 5
-1253667 6
1510233 7
-1269836 8
1613725 9
-1505401 10
2178612 11
-2036205 12
2410454 13
-4326153 14
4947830 15
-4326154 16
4839162 17
-4352027 18
5026619 19
-4422789 20
4570760 21
-4868075 22
5163827 23
-5607853 24
6199786 25
-6221258 26
6...

output:

3656716

result:

ok single line: '3656716'

Test #25:

score: 14
Accepted
time: 2ms
memory: 11744kb

input:

1997 1
-1 0
4128 1
-3993 2
74560 3
-4107 4
29412 5
-124282 6
167990 7
-266635 8
285731 9
-296541 10
359960 11
-345943 12
403009 13
-559702 14
590908 15
-645298 16
667991 17
-713997 18
770876 19
-724771 20
761259 21
-745145 22
841278 23
-1132098 24
1209778 25
-1149601 26
1169460 27
-1207652 28
124597...

output:

1976688

result:

ok single line: '1976688'

Test #26:

score: 14
Accepted
time: 0ms
memory: 11924kb

input:

1997 221858
-906800 0
1458469 1
-3490423 2
4305248 3
-7528333 4
8000537 5
-7885388 6
7958703 7
-11393926 8
11980747 9
-11747944 10
12721208 11
-17195863 12
17436265 13
-19104428 14
19963703 15
-19221213 16
19790185 17
-26786612 18
27186963 19
-30098944 20
30428098 21
-30159706 22
30725701 23
-345052...

output:

471142643

result:

ok single line: '471142643'

Test #27:

score: 14
Accepted
time: 1ms
memory: 11924kb

input:

1996 849690
-28008524 0
28806149 1
-60092337 2
60377234 3
-86664447 4
86839975 5
-88838841 6
89792065 7
-118219083 8
118579228 9
-130374280 10
130705881 11
-184972834 12
185236973 13
-213002399 14
213944112 15
-225039106 16
225182999 17
-225237975 18
225413754 19
-234633304 20
234637320 21
-25407696...

output:

361576027

result:

ok single line: '361576027'

Test #28:

score: 14
Accepted
time: 2ms
memory: 11880kb

input:

1997 119135
-152044487 0
152804173 1
-397670939 2
397750796 3
-376672967 0
376746022 5
-417762437 6
418515035 7
-34613749 0
34835024 9
-414368835 0
414736822 11
-376229751 0
376495945 13
-384945031 14
385225811 15
-12089459 0
12451971 17
-389844127 18
390409800 19
-273473837 0
274006345 21
-15884699...

output:

27348525

result:

ok single line: '27348525'

Test #29:

score: 14
Accepted
time: 1ms
memory: 11860kb

input:

1998 942452
-17200029 0
17682105 1
-157988703 2
158288198 3
-4465812 0
4520447 5
-83969677 6
84083777 7
-377563619 8
378402838 9
-179102286 0
179287702 11
-182471742 12
182476796 13
-306751887 14
307033334 15
-459185361 16
460089539 17
-264044243 0
264411886 19
-299850633 20
300594894 21
-181708015 ...

output:

451229996

result:

ok single line: '451229996'

Test #30:

score: 14
Accepted
time: 1ms
memory: 11740kb

input:

1997 111
-71 0
70 1
0 2
0 3
-44 4
-61 5
26570 6
-108 7
19586 8
-109 9
77880 10
-110 11
8653 12
-111 13
84092 14
-39918 15
99150 16
-59706 17
95315 18
-128192 19
215712 20
-130737 21
132166 22
-250104 23
349032 24
-254356 25
304569 26
-273875 27
339811 28
-336187 29
355943 30
-404056 31
495501 32
-38...

output:

7053779

result:

ok single line: '7053779'

Test #31:

score: 14
Accepted
time: 0ms
memory: 11936kb

input:

1998 23414
-21438 0
65346 1
-21835 2
97920 3
-23231 4
61068 5
-173492 6
259764 7
-298330 8
340444 9
-314229 10
392678 11
-337064 12
411806 13
-377880 14
439107 15
-407467 16
481499 17
-473066 18
481956 19
-653829 20
706334 21
-1121383 22
1176305 23
-1143687 24
1168817 25
-1282829 26
1291310 27
-1289...

output:

42402445

result:

ok single line: '42402445'

Test #32:

score: 14
Accepted
time: 1ms
memory: 11864kb

input:

1996 82712
-316962 0
348266 1
-656551 2
664343 3
-1202654 4
1206638 5
-2231912 6
2292459 7
-3208507 8
3265411 9
-3283532 10
3290943 11
-3296785 12
3322367 13
-3355692 14
3432232 15
-3603791 16
3664502 17
-3791800 18
3846615 19
-4202013 20
4282980 21
-4239315 22
4286812 23
-4585108 24
4683584 25
-464...

output:

49210123

result:

ok single line: '49210123'

Test #33:

score: 14
Accepted
time: 1ms
memory: 11864kb

input:

1996 412723
-1285799 0
-2785143 1
-1915618 2
-31151 3
-10385 4
-352 5
-834 6
-271 7
-56 8
2286147 9
-1990814 10
-3346 11
-267118 12
-8046 13
-1982 14
-11516 15
-1886 16
5486951 17
-5461283 18
-14404 19
-8792 20
-2625 21
-1260 22
-50 23
-7 24
-5 25
-4 26
-2 27
-5 28
-1 29
6722984 30
-14074029 31
1421...

output:

274648629

result:

ok single line: '274648629'

Test #34:

score: 14
Accepted
time: 2ms
memory: 11876kb

input:

1996 96055
-163124760 0
163196597 1
-439679475 0
440015968 3
-330108552 0
330659538 5
-133814317 0
134036406 7
-361200860 0
361857023 9
-448386315 10
448562742 11
-305879265 0
306771045 13
-21948420 0
22559969 15
-444868398 0
445604686 17
-79688092 0
80526514 19
-161275407 20
162273868 21
-378895805...

output:

217568388

result:

ok single line: '217568388'

Test #35:

score: 14
Accepted
time: 2ms
memory: 11788kb

input:

1998 53059
-17596215 0
17635693 1
-24626608 2
24636115 3
-42169815 4
42235610 5
-48165922 6
48208633 7
-5034181 0
5043935 9
-44483459 10
44555839 11
-9484773 0
9498470 13
-17554127 14
17624124 15
-18632954 16
18643094 17
-11271715 0
11354481 19
-26953622 20
26963318 21
-27911140 0
28010094 23
-33163...

output:

47280019

result:

ok single line: '47280019'

Test #36:

score: 14
Accepted
time: 1ms
memory: 11876kb

input:

1998 100000
-36651 0
79063 1
-66318 2
116300 3
-94671 4
192399 5
-96166 6
121962 7
-99408 8
192332 9
-99527 10
165939 11
-99979 12
162744 13
-99990 14
178653 15
-99995 16
153909 17
-99997 18
102347 19
-99999 20
118015 21
-100000 22
185649 23
-546732 24
547012 25
-120651 26
-200831 27
276570 28
-2039...

output:

33334487

result:

ok single line: '33334487'

Test #37:

score: 14
Accepted
time: 0ms
memory: 11804kb

input:

1998 2750
-2674 0
939050 1
-2698 2
188682 3
-2750 4
349736 5
-76242 6
769422 7
-196140 8
736133 9
-223700 10
677360 11
-464369 12
1046139 13
-954432 14
1062023 15
-2825470 16
3729410 17
-3055569 18
3526003 19
-5955115 20
6192412 21
-8330959 22
8467897 23
-8435464 24
8650112 25
-8500021 26
8610167 27...

output:

62813522

result:

ok single line: '62813522'

Test #38:

score: 14
Accepted
time: 0ms
memory: 11792kb

input:

1996 9484
-482266 0
571044 1
-644059 2
734857 3
-1903590 4
1913094 5
-1969178 6
2030836 7
-2700941 8
2787436 9
-2758519 10
2857182 11
-2817204 12
2902534 13
-3223663 14
3271392 15
-3228009 16
3290047 17
-3937562 18
4026698 19
-3942339 20
3957812 21
-4035116 22
4101986 23
-4362539 24
4395213 25
-4416...

output:

10779086

result:

ok single line: '10779086'

Test #39:

score: 14
Accepted
time: 2ms
memory: 13844kb

input:

1996 43507
-43499 0
74123 1
-4468514 2
4560077 3
-7686298 4
7774199 5
-10115287 6
10210356 7
-15544964 8
15576507 9
-15914328 10
15990423 11
-16194873 12
16267151 13
-17397927 14
17456031 15
-17668924 16
17741741 17
-19882595 18
19960608 19
-21749798 20
21831533 21
-22366924 22
22432174 23
-26775628...

output:

9707042

result:

ok single line: '9707042'

Test #40:

score: 14
Accepted
time: 1ms
memory: 11868kb

input:

1998 16132
-27815063 0
27845919 1
-16124 0
70139 3
-543295 4
564956 5
-43991673 0
44070836 7
-861535 0
892306 9
-27107826 10
27120048 11
-29224292 12
29297130 13
-27370277 0
27442809 15
-38643375 16
38698533 17
-33817752 0
33905960 19
-1485102 0
1495381 21
-41707228 0
41800507 23
-30740171 0
3077709...

output:

6188757

result:

ok single line: '6188757'

Test #41:

score: 14
Accepted
time: 1ms
memory: 11884kb

input:

1991 35671
-22386 0
40467 1
-193576 2
204855 3
-291681 4
353201 5
-353949 6
362997 7
-367838 8
422419 9
-438001 10
530583 11
-473090 12
556111 13
-557456 14
649915 15
-628847 16
711329 17
-738620 18
792063 19
-834325 20
868739 21
-872848 22
963283 23
-896848 24
969140 25
-1001626 26
1073886 27
-1079...

output:

46098536

result:

ok single line: '46098536'

Subtask #3:

score: 15
Accepted

Test #42:

score: 15
Accepted
time: 87ms
memory: 41796kb

input:

300000 0
-1677 0
1678 1
-3010 2
3011 3
-8141 4
8142 5
-11233 6
11234 7
-14400 8
14401 9
-17045 10
17046 11
-19521 12
19522 13
-23178 14
23179 15
-26907 16
26908 17
-28884 18
28885 19
-30742 20
30743 21
-35957 22
35958 23
-38436 24
38437 25
-39739 26
39740 27
-42432 28
42433 29
-47866 30
47867 31
-48...

output:

150000

result:

ok single line: '150000'

Test #43:

score: 15
Accepted
time: 87ms
memory: 43860kb

input:

300000 0
-2707 0
2708 1
-35703 2
35704 3
-87028 4
87029 5
-90666 6
90667 7
-144441 8
144442 9
-13210 0
13211 11
-54700 12
54701 13
-65742 14
65743 15
-118284 16
118285 17
-128694 18
128695 19
-7111 0
7112 21
-57902 22
57903 23
-79725 24
79726 25
-110281 26
110282 27
-124571 28
124572 29
-18852 0
188...

output:

150000

result:

ok single line: '150000'

Test #44:

score: 15
Accepted
time: 93ms
memory: 43796kb

input:

300000 0
-62936 0
62937 1
-137762 0
137763 3
-73582 0
73583 5
-66183 0
66184 7
-75047 0
75048 9
-43684 0
43685 11
-2721 0
2722 13
-111595 0
111596 15
-61005 0
61006 17
-85734 0
85735 19
-87099 0
87100 21
-140862 0
140863 23
-12218 0
12219 25
-68482 0
68483 27
-40203 0
40204 29
-34323 0
34324 31
-374...

output:

150000

result:

ok single line: '150000'

Test #45:

score: 15
Accepted
time: 71ms
memory: 41744kb

input:

299994 8
-3 0
11 1
-9 2
15 3
-21 4
25 5
-23 6
33 7
-33 8
40 9
-37 10
44 11
-45 12
48 13
-52 14
60 15
-61 16
65 17
-63 18
66 19
-66 20
69 21
-70 22
75 23
-74 24
77 25
-78 26
88 27
-84 28
92 29
-97 30
106 31
-102 32
104 33
-108 34
112 35
-110 36
116 37
-116 38
121 39
-119 40
127 41
-125 42
131 43
-136...

output:

546593

result:

ok single line: '546593'

Test #46:

score: 15
Accepted
time: 66ms
memory: 41732kb

input:

299982 3
-1 0
4 1
-13 2
18 3
-17 4
22 5
-23 6
32 7
-37 8
39 9
-45 10
53 11
-47 12
49 13
-66 14
69 15
-73 16
81 17
-86 18
94 19
-122 20
126 21
-132 22
140 23
-139 24
145 25
-160 26
169 27
-163 28
167 29
-174 30
184 31
-184 32
190 33
-208 34
212 35
-215 36
216 37
-228 38
234 39
-237 40
243 41
-258 42
...

output:

80601

result:

ok single line: '80601'

Test #47:

score: 15
Accepted
time: 80ms
memory: 43628kb

input:

299990 2
-23 0
31 1
-41 2
42 3
-58 4
59 5
-111 6
116 7
-160 8
162 9
-228 10
237 11
-263 12
272 13
-274 14
281 15
-280 16
285 17
-301 18
309 19
-373 20
377 21
-389 22
396 23
-412 24
421 25
-492 26
494 27
-526 28
527 29
-552 30
555 31
-557 32
559 33
-586 34
590 35
-665 36
668 37
-754 38
758 39
-806 40...

output:

316743

result:

ok single line: '316743'

Test #48:

score: 15
Accepted
time: 39ms
memory: 26916kb

input:

149994 26541
-439675 0
463550 1
-860082 2
861744 3
-2380011 4
2406491 5
-2513061 6
2529487 7
-2659949 8
2689497 9
-4255225 10
4273734 11
-4437937 12
4445358 13
-4557620 14
4561451 15
-8289638 16
8301552 17
-10171357 18
10177628 19
-10807126 20
10832987 21
-11615970 22
11642203 23
-12144344 24
121671...

output:

328128683

result:

ok single line: '328128683'

Test #49:

score: 15
Accepted
time: 92ms
memory: 41744kb

input:

299992 10401
-562387282 0
562396503 1
-726656747 2
726657432 3
-897911244 0
897924839 5
-372769882 0
372769956 7
-847289191 8
847302716 9
-385403954 0
385412618 11
-724364491 12
724375939 13
-714343972 0
714361026 15
-57383227 0
57384838 17
-677425239 18
677436619 19
-84798684 0
84799922 21
-4079996...

output:

989551522

result:

ok single line: '989551522'

Test #50:

score: 15
Accepted
time: 90ms
memory: 43848kb

input:

299996 2325
-14446016 0
14446501 1
-77526933 2
77534181 3
-81726390 4
81739095 5
-147061782 6
147072239 7
-189940393 8
189952226 9
-195690126 10
195692100 11
-382050781 12
382051641 13
-399122179 14
399134670 15
-402431158 16
402439800 17
-446803982 18
446809172 19
-506091259 20
506095653 21
-537286...

output:

923414642

result:

ok single line: '923414642'

Test #51:

score: 15
Accepted
time: 80ms
memory: 43780kb

input:

299714 4
-1 0
11 1
-2 2
9 3
-4 4
9 5
-25 6
26 7
-26 8
36 9
-27 10
37 11
-46 12
48 13
-49 14
52 15
-51 16
52 17
-52 18
61 19
-55 20
64 21
-59 22
64 23
-60 24
65 25
-80 26
88 27
-63 28
-15 29
-2 30
-1 31
14 32
-5 33
-1 34
-2 35
-6 36
16 37
-16 38
88 39
-85 40
92 41
-94 42
101 43
-108 44
112 45
-109 46...

output:

467395

result:

ok single line: '467395'

Test #52:

score: 15
Accepted
time: 78ms
memory: 43836kb

input:

299991 4
-3 0
11 1
-18 2
24 3
-27 4
28 5
-30 6
33 7
-40 8
50 9
-61 10
65 11
-72 12
79 13
-85 14
86 15
-96 16
97 17
-98 18
108 19
-100 20
103 21
-150 22
154 23
-156 24
164 25
-157 26
165 27
-160 28
163 29
-171 30
181 31
-173 32
178 33
-208 34
214 35
-215 36
217 37
-223 38
231 39
-238 40
240 41
-239 4...

output:

239860

result:

ok single line: '239860'

Test #53:

score: 15
Accepted
time: 70ms
memory: 41784kb

input:

294992 5085
-72774 0
74763 1
-76113 2
86739 3
-93763 4
97157 5
-124339 6
137283 7
-174838 8
176244 9
-199049 10
204611 11
-215064 12
216402 13
-316677 14
324228 15
-361389 16
367426 17
-371429 18
383740 19
-405831 20
406000 21
-411010 22
417755 23
-422257 24
429482 25
-528128 26
538487 27
-599037 28...

output:

365896849

result:

ok single line: '365896849'

Test #54:

score: 15
Accepted
time: 78ms
memory: 43772kb

input:

299995 100000
-100231 0
100236 1
-100248 2
100256 3
-100345 4
100351 5
-100373 6
100379 7
-100774 8
100779 9
-100831 10
100840 11
-100970 12
100974 13
-101191 14
101196 15
-101499 16
101500 17
-102059 18
102062 19
-102549 20
102556 21
-102899 22
102905 23
-102980 24
102984 25
-103113 26
103120 27
-1...

output:

57084

result:

ok single line: '57084'

Test #55:

score: 15
Accepted
time: 47ms
memory: 30788kb

input:

149988 1
-687907470 0
687930584 1
-417118419 0
417143769 3
-676593922 4
676619412 5
-50271258 0
50293214 7
-393243855 0
393267175 9
-732502071 0
732520398 11
-568914480 0
568928416 13
-713251602 14
713273415 15
-392353315 0
392377048 17
-139174068 0
139199229 19
-360621458 20
360638263 21
-628726188...

output:

189881793

result:

ok single line: '189881793'

Test #56:

score: 15
Accepted
time: 79ms
memory: 43772kb

input:

299997 6
-38292 0
38302 1
-38470 2
38476 3
-62961 4
62967 5
-74680 6
74690 7
-86773 8
86779 9
-92384 10
92386 11
-123954 12
123964 13
-141010 14
141020 15
-148004 16
148010 17
-173352 18
173354 19
-210885 20
210887 21
-214275 22
214280 23
-225243 24
225250 25
-254936 26
254938 27
-260210 28
260220 2...

output:

550922

result:

ok single line: '550922'

Test #57:

score: 15
Accepted
time: 60ms
memory: 41768kb

input:

294994 100000
-53267 0
61130 1
-79222 2
85873 3
-107915 4
115455 5
-112228 6
113910 7
-112584 8
115824 9
-113297 10
118841 11
-119314 12
128608 13
-120801 14
125670 15
-124029 16
126797 17
-128464 18
130068 19
-131571 20
134871 21
-137885 22
145738 23
-143626 24
149662 25
-167958 26
180727 27
-16801...

output:

274262574

result:

ok single line: '274262574'

Test #58:

score: 15
Accepted
time: 81ms
memory: 41788kb

input:

299997 10
-6 0
16 1
-8 2
15 3
-10 4
13 5
-19 6
28 7
-61 8
66 9
-64 10
70 11
-72 12
76 13
-76 14
81 15
-100 16
101 17
-105 18
114 19
-106 20
108 21
-111 22
112 23
-120 24
126 25
-126 26
133 27
-178 28
179 29
-184 30
185 31
-193 32
195 33
-196 34
206 35
-212 36
222 37
-218 38
219 39
-230 40
238 41
-25...

output:

175947

result:

ok single line: '175947'

Test #59:

score: 15
Accepted
time: 71ms
memory: 41728kb

input:

299990 9
-5 0
8 1
-48 2
52 3
-54 4
57 5
-103 6
110 7
-140 8
143 9
-160 10
165 11
-174 12
184 13
-237 14
244 15
-241 16
250 17
-272 18
277 19
-277 20
280 21
-308 22
318 23
-325 24
327 25
-353 26
357 27
-406 28
413 29
-415 30
424 31
-459 32
464 33
-461 34
466 35
-504 36
510 37
-511 38
521 39
-539 40
5...

output:

550792

result:

ok single line: '550792'

Test #60:

score: 15
Accepted
time: 87ms
memory: 41724kb

input:

299994 100000
-100506 0
100515 1
-100660 2
100663 3
-100987 4
100992 5
-101132 6
101137 7
-101141 8
101145 9
-101392 10
101402 11
-101396 12
101404 13
-101603 14
101604 15
-102437 16
102447 17
-102691 18
102696 19
-102993 20
102994 21
-103046 22
103054 23
-103164 24
103169 25
-103417 26
103420 27
-1...

output:

687401

result:

ok single line: '687401'

Test #61:

score: 15
Accepted
time: 90ms
memory: 43712kb

input:

299996 12662
-764150505 0
764154355 1
-164899282 0
164908249 3
-77774672 0
77785067 5
-927590971 6
927601220 7
-753611407 0
753623252 9
-527093349 0
527098815 11
-730535110 0
730546714 13
-230253570 0
230261838 15
-823670420 0
823681950 17
-343004826 0
343013016 19
-429083625 0
429087224 21
-1124625...

output:

984311051

result:

ok single line: '984311051'

Test #62:

score: 15
Accepted
time: 89ms
memory: 41688kb

input:

294996 4464
-122392220 0
122399223 1
-123842459 2
123842731 3
-141572179 4
141574986 5
-149670765 6
149678268 7
-202488152 8
202488272 9
-286825212 10
286826478 11
-300314838 12
300323274 13
-333301791 14
333312598 15
-334098186 16
334107636 17
-409469632 18
409470208 19
-507956579 20
507964975 21
-...

output:

968055496

result:

ok single line: '968055496'

Test #63:

score: 15
Accepted
time: 63ms
memory: 41688kb

input:

294994 100000
-14187 0
16465 1
-65648 2
73985 3
-94121 4
106271 5
-98539 6
105943 7
-99663 8
110632 9
-99984 10
103563 11
-99996 12
111846 13
-99998 14
106428 15
-100000 16
111738 17
-107125 18
119496 19
-111071 20
123668 21
-111772 22
112969 23
-117209 24
120950 25
-119423 26
125010 27
-128516 28
1...

output:

196146846

result:

ok single line: '196146846'

Test #64:

score: 15
Accepted
time: 62ms
memory: 30836kb

input:

199974 27673
-24895 0
43456 1
-26158 2
66281 3
-26914 4
27129 5
-27057 6
28853 7
-27572 8
69471 9
-27643 10
47878 11
-141377 12
185522 13
-216702 14
226344 15
-111419 16
-36939 17
-22123 18
-28943 19
-24286 20
-10606 21
-3899 22
-1372 23
-1299 24
-344 25
-1230 26
-8 27
-31 28
-15 29
-5 30
-3 31
0 32...

output:

359945585

result:

ok single line: '359945585'

Test #65:

score: 15
Accepted
time: 77ms
memory: 43656kb

input:

299996 9
-9 0
13 1
-11 2
18 3
-24 4
26 5
-32 6
41 7
-41 8
44 9
-45 10
53 11
-48 12
58 13
-72 14
77 15
-73 16
82 17
-99 18
104 19
-172 20
174 21
-198 22
204 23
-202 24
204 25
-318 26
321 27
-325 28
332 29
-374 30
375 31
-382 32
385 33
-425 34
430 35
-529 36
536 37
-532 38
533 39
-535 40
538 41
-571 4...

output:

3417

result:

ok single line: '3417'

Test #66:

score: 15
Accepted
time: 59ms
memory: 28712kb

input:

199992 7203
-2802987 0
2827233 1
-2982480 2
3025553 3
-3683773 4
3709952 5
-6512883 6
6537851 7
-6572011 8
6583130 9
-7317439 10
7340712 11
-7551088 12
7554988 13
-8414839 14
8426746 15
-8523367 16
8566059 17
-10049326 18
10069521 19
-12317740 20
12361011 21
-12354236 22
12392109 23
-12643120 24
126...

output:

559452499

result:

ok single line: '559452499'

Test #67:

score: 15
Accepted
time: 90ms
memory: 43836kb

input:

299992 9
-80493 0
80498 1
-654008 0
654014 3
-225957 0
225965 5
-233411 6
233417 7
-598943 8
598953 9
-327426 0
327435 11
-523498 12
523507 13
-806945 0
806946 15
-179018 0
179022 17
-182989 18
182991 19
-177944 0
177945 21
-263325 0
263332 23
-793262 24
793265 25
-71500 0
71504 27
-271791 0
271797 ...

output:

824530

result:

ok single line: '824530'

Test #68:

score: 15
Accepted
time: 87ms
memory: 41616kb

input:

294988 100000
-827500 0
838015 1
-8263400 2
8264075 3
-30995602 4
30999821 5
-48186747 6
48197718 7
-54458919 8
54467402 9
-62635677 10
62648045 11
-66319610 12
66326129 13
-124271079 14
124279776 15
-152444203 16
152445201 17
-195712741 18
195714045 19
-197291872 20
197293060 21
-234457004 22
23446...

output:

824075760

result:

ok single line: '824075760'

Test #69:

score: 15
Accepted
time: 60ms
memory: 43672kb

input:

294990 7540
-2879 0
7324 1
-3311 2
11283 3
-3518 4
4853 5
-3757 6
9124 7
-4104 8
10814 9
-5190 10
6462 11
-5905 12
11335 13
-7396 14
11129 15
-7533 16
20192 17
-7539 18
18425 19
-7540 20
9505 21
-15894 22
27156 23
-18304 24
31061 25
-28643 26
32431 27
-31885 28
38141 29
-32483 30
37014 31
-32534 32
...

output:

40925630

result:

ok single line: '40925630'

Test #70:

score: 15
Accepted
time: 62ms
memory: 43848kb

input:

299990 1
-6 0
9 1
-17 2
21 3
-30 4
34 5
-41 6
42 7
-49 8
56 9
-60 10
68 11
-62 12
69 13
-68 14
77 15
-89 16
93 17
-96 18
101 19
-97 20
102 21
-100 22
110 23
-101 24
106 25
-102 26
108 27
-109 28
116 29
-111 30
114 31
-112 32
119 33
-115 34
121 35
-131 36
135 37
-132 38
137 39
-133 40
136 41
-136 42
...

output:

696933

result:

ok single line: '696933'

Test #71:

score: 15
Accepted
time: 68ms
memory: 41608kb

input:

299990 1
-23 0
27 1
-44 2
54 3
-92 4
95 5
-122 6
126 7
-148 8
153 9
-198 10
199 11
-213 12
218 13
-215 14
217 15
-221 16
227 17
-225 18
228 19
-235 20
240 21
-320 22
321 23
-354 24
358 25
-360 26
370 27
-397 28
406 29
-404 30
408 31
-418 32
420 33
-429 34
434 35
-435 36
440 37
-436 38
440 39
-453 40...

output:

130652

result:

ok single line: '130652'

Test #72:

score: 15
Accepted
time: 88ms
memory: 43772kb

input:

299991 100000
-100123 0
100126 1
-100870 2
100877 3
-101026 4
101032 5
-101725 6
101728 7
-101784 8
101785 9
-101951 10
101959 11
-102230 12
102234 13
-102257 14
102258 15
-102318 16
102322 17
-102459 18
102463 19
-102492 20
102495 21
-103137 22
103144 23
-104103 24
104109 25
-104321 26
104328 27
-1...

output:

662809

result:

ok single line: '662809'

Test #73:

score: 15
Accepted
time: 81ms
memory: 41732kb

input:

299990 100000
-704356 0
704364 1
-315264 0
315274 3
-569639 0
569642 5
-830919 6
830922 7
-916530 8
916538 9
-481124 0
481126 11
-350625 0
350629 13
-451461 14
451463 15
-747898 0
747899 17
-127099 0
127105 19
-370813 20
370822 21
-770906 22
770910 23
-809096 24
809106 25
-875612 26
875620 27
-89659...

output:

48160

result:

ok single line: '48160'

Test #74:

score: 15
Accepted
time: 81ms
memory: 41724kb

input:

299988 8
-15304 0
15306 1
-53300 2
53307 3
-60332 4
60342 5
-68205 6
68209 7
-104960 8
104967 9
-134298 10
134304 11
-155442 12
155449 13
-159853 14
159854 15
-169647 16
169656 17
-173988 18
173993 19
-214391 20
214392 21
-289728 22
289732 23
-312901 24
312904 25
-337616 26
337617 27
-365767 28
3657...

output:

440048

result:

ok single line: '440048'

Test #75:

score: 15
Accepted
time: 71ms
memory: 41744kb

input:

299997 4143
-5607 0
5703 1
-17978 2
23331 3
-26405 4
36982 5
-38661 6
42045 7
-100340 8
104723 9
-120161 10
124408 11
-130559 12
133017 13
-139548 14
144402 15
-263527 16
264427 17
-275295 18
286250 19
-303234 20
315915 21
-402288 22
403614 23
-419063 24
426431 25
-436072 26
441968 27
-444446 28
447...

output:

987793871

result:

ok single line: '987793871'

Subtask #4:

score: 29
Accepted

Dependency #2:

100%
Accepted

Test #76:

score: 29
Accepted
time: 1ms
memory: 11924kb

input:

6 1
3 0
-3 1
-5 0
2 1
6 3
-4 5

output:

6

result:

ok single line: '6'

Test #77:

score: 29
Accepted
time: 2ms
memory: 11920kb

input:

1992 100000
-123091 0
-30281 0
-21906 2
171526 1
-164573 4
78303 3
-539585 6
170968 5
-178934 6
-508341 8
-475191 8
518159 11
636961 7
-1375943 12
-1134601 13
-310451 4
243776 9
-261962 17
331531 18
1201616 15
-1488800 19
519773 10
-1589229 12
-1624437 22
1636816 23
-604851 13
-2491287 20
338512 16
...

output:

29871319

result:

ok single line: '29871319'

Test #78:

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

input:

1995 100000
-100015 0
-100035 0
-100004 0
-100023 0
100023 1
-100324 5
-100105 5
-43606 0
100107 7
100013 3
-100079 10
100031 4
-100207 12
-100219 10
-102221 9
100224 14
-100359 5
-100113 10
-100242 10
-101073 16
100038 2
-101171 9
-100687 21
-100054 21
-100779 16
101080 20
-100081 5
100365 17
-1004...

output:

2706

result:

ok single line: '2706'

Test #79:

score: 29
Accepted
time: 2ms
memory: 11920kb

input:

1995 100000
-100874 0
-100123 0
-100279 0
-100025 0
-100033 0
-100128 0
-100352 0
100030 4
-100054 0
-100789 0
-100164 0
-100023 0
-100082 0
-100088 0
-100414 0
100883 1
-100106 0
-100132 0
-100210 0
-104174 16
-100573 0
-100043 0
-103937 8
-100089 0
100091 14
100039 5
-100198 0
-100039 0
100046 28
...

output:

241

result:

ok single line: '241'

Test #80:

score: 29
Accepted
time: 2ms
memory: 11736kb

input:

1991 7
-1255 0
-2528 0
-822 0
-388 0
-1441 0
-2254 0
-3839 0
-782 0
-2530 0
-1586 0
-844 0
-2370 0
-756 0
-1171 0
-3768 0
-1563 0
-2452 0
-1475 0
-4270 0
-2079 0
-599 0
-2220 0
-2065 0
-139 0
1596 10
-1211 0
-4231 0
-3256 0
-348 0
-2600 0
-2036 0
-2011 0
-3473 0
-2426 0
-614 0
-1640 0
-2614 0
-1797 ...

output:

4143

result:

ok single line: '4143'

Test #81:

score: 29
Accepted
time: 1ms
memory: 11940kb

input:

1994 98229
-25011 0
-28801007 0
28812436 2
31607 1
-98668 4
175546 5
-125883 6
135777 7
-10384621 4
-12045979 6
-187727 8
10448416 9
-46915950 8
47004608 13
206079 11
12137635 10
-17969925 15
18052237 17
-202812 15
284861 19
-10901049 20
10987634 21
-279111 20
373407 23
-37466576 24
37553653 25
-301...

output:

14506418

result:

ok single line: '14506418'

Test #82:

score: 29
Accepted
time: 1ms
memory: 11792kb

input:

1994 4
-1 0
-5 0
2 1
11 2
-13 4
15 5
-17 6
23 7
-10 4
-19 6
22 10
-29 11
38 12
-26 11
-41 13
-33 13
14 9
46 15
-48 18
30 14
35 16
55 19
-44 18
46 23
-55 22
64 25
-62 22
66 27
-70 28
74 29
-68 28
-79 30
75 31
88 32
-83 30
88 35
-97 36
98 37
-98 38
-93 36
-62 40
106 39
-1 41
-99 38
-15 41
23 45
9 43
-...

output:

5191

result:

ok single line: '5191'

Test #83:

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

input:

1933 100000
-17223 0
17227 1
-69253 2
-89374 2
69262 3
89381 4
-100011 6
100017 7
-100007 5
-100075 8
-100012 6
100015 9
100016 11
-100042 12
-100044 8
100046 14
-100021 13
100026 17
100047 15
-100083 19
-100051 16
100087 20
-100096 22
-100045 19
100059 21
100052 24
100085 10
-100061 25
-100354 27
-...

output:

1181

result:

ok single line: '1181'

Test #84:

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

input:

1988 1
-49 0
-9 0
-8 0
-38 0
51 1
46 4
-56 6
-214 5
-599 5
-211 5
-109 6
-80 0
-215 5
220 13
16 3
116 11
-1037 14
-1 0
-153 15
-451 5
215 8
-78 6
-3126 14
457 20
-1720 14
-344 5
-1883 16
609 9
162 19
-1076 16
87 22
-89 15
-1423 28
11 18
19 2
-92 15
1730 25
-792 28
-245 14
-11 34
-158 15
-415 6
-2401...

output:

4072

result:

ok single line: '4072'

Test #85:

score: 29
Accepted
time: 1ms
memory: 11864kb

input:

1996 1
-155 0
-890 0
-60 0
-410 0
-264 0
-76 0
-72 0
-181 0
418 4
-47 0
-1805 9
-40 0
-9 0
-188 0
-1815 9
190 14
-130 0
-3715 16
-400 16
19 13
-874 16
879 21
3720 18
-751 0
-100 0
-437 0
47 12
-788 27
-71 0
78 29
-224 0
-133 27
-2458 16
759 24
-1368 9
-1470 16
-1827 30
-3286 30
-251 0
-2012 27
-2908...

output:

1797

result:

ok single line: '1797'

Test #86:

score: 29
Accepted
time: 1ms
memory: 11864kb

input:

1994 65443
-38003318 0
-18751475 0
-9734401 0
-18645890 0
-15668970 0
-17905454 0
-6796761 0
9812780 3
-20552708 0
-27344191 0
-12387671 0
-19533911 0
-8278752 0
-8310591 0
-16585891 0
-18322444 0
-28482172 0
-11198931 0
-21697231 0
-19967830 0
-1513124 0
-4799039 0
-9896868 0
-7389109 0
18344759 16...

output:

39365641

result:

ok single line: '39365641'

Test #87:

score: 29
Accepted
time: 1ms
memory: 11876kb

input:

1901 100000
-104214 0
104219 1
-46319 0
46328 3
-101616 4
-66898 4
66903 6
-102765 7
-86535 7
101618 5
102773 8
86537 9
-104225 12
104226 13
-100015 12
100023 15
-100777 16
100784 17
-100018 16
100025 19
-100020 20
-100959 20
100965 22
100027 21
-100023 24
-101058 24
101060 26
100030 25
-100278 28
1...

output:

1196

result:

ok single line: '1196'

Test #88:

score: 29
Accepted
time: 1ms
memory: 11740kb

input:

1898 9
-9 0
16 1
-8 0
-19 2
15 3
-10 2
17 6
21 4
-33 8
37 9
-29 8
32 11
-40 10
-39 10
42 14
42 13
-49 16
-42 16
56 17
-51 19
-55 19
64 21
58 20
48 18
-56 22
-61 22
64 25
63 26
-87 28
-71 28
93 29
77 30
-90 31
95 33
-91 31
93 35
-98 36
102 37
-95 36
100 39
-107 38
-110 38
115 42
-114 43
-112 43
121 4...

output:

957

result:

ok single line: '957'

Test #89:

score: 29
Accepted
time: 1ms
memory: 11824kb

input:

1994 100000
-82876 0
173951 1
-91781 2
162991 3
-372977 4
471319 5
-97733 2
-405921 6
-79149 0
491609 8
132818 7
-443797 11
480621 12
-670304 13
719700 14
-1417516 15
-675583 15
-491916 10
726063 17
121319 9
1496966 16
-1213898 19
1267835 22
-4905568 19
-481426 13
512055 25
-3133440 21
-5448924 26
-...

output:

34358020

result:

ok single line: '34358020'

Test #90:

score: 29
Accepted
time: 2ms
memory: 11864kb

input:

1992 4
-13 0
-1 0
-18 0
-2 0
-8 0
18 1
-160 6
-281 6
289 8
-10 0
-266 6
-321 6
11 10
12 5
-9 14
-78 13
-197 6
-1475 9
-2148 9
1484 18
165 7
274 11
4 2
-349 21
-1158 22
21 3
1167 25
-88 13
-1389 21
-129 26
-484 9
11 15
-153 26
-22 6
-791 22
82 16
204 17
-206 32
-344 23
-199 14
354 39
92 28
-745 21
-2...

output:

2570

result:

ok single line: '2570'

Test #91:

score: 29
Accepted
time: 2ms
memory: 13932kb

input:

1990 100000
-100242 0
-100942 0
-100115 0
-100204 0
-100144 0
-100325 0
-100071 0
-100655 0
-100479 0
-51715 0
-100228 0
100331 6
100145 5
-100223 0
-100635 0
100123 3
-101264 13
-100030 0
-101712 12
-100042 0
-103222 16
-100771 13
-104218 13
-105562 13
-104492 16
-59480 0
-100609 16
100236 11
-1005...

output:

2661

result:

ok single line: '2661'

Test #92:

score: 29
Accepted
time: 1ms
memory: 11860kb

input:

1996 5
-98 0
-2663 0
-2375 0
-3018 0
-2217 0
-1570 0
-172 0
-1132 0
-3560 0
-1926 0
-482 0
-299 0
-1811 0
-29 0
-103 0
-3084 0
-1743 0
-3269 0
-3583 0
-1323 0
-595 0
-194 0
2666 2
1928 10
-651 0
-1488 0
-2823 0
-2661 0
-3897 0
1751 17
-162 0
-2317 0
-2417 0
-3261 0
-2819 0
-2235 0
-906 0
-3135 0
-16...

output:

3215

result:

ok single line: '3215'

Test #93:

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

input:

1991 1
-1 0
-2078 0
2080 2
11 1
-1927 4
-3 4
13 6
1937 5
-592 7
596 9
-11 7
16 11
-12 12
19 13
-2820 12
-1131 14
2822 15
-13 14
1136 16
16 18
-1634 20
-22 20
32 22
1635 21
-1997 23
-25 23
2000 25
29 26
-3032 28
3041 29
-30 28
32 31
-3523 32
3528 33
-31 32
40 35
-32 36
33 37
-5014 36
5018 39
-1688 38...

output:

1386

result:

ok single line: '1386'

Test #94:

score: 29
Accepted
time: 1ms
memory: 11860kb

input:

1990 8477
-1790 0
-6417 0
40482 2
-76026 3
61501 1
-97265 3
115139 4
146268 6
-165045 8
-77341 8
-35192 10
-2259 10
94122 11
-32933 12
194078 9
82216 14
-225518 15
268342 17
-223711 15
-229725 18
258070 19
230454 20
-231987 18
234998 23
-1348 12
-31585 25
-246098 24
-240867 24
308003 28
-5342 25
-26...

output:

25076974

result:

ok single line: '25076974'

Test #95:

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

input:

1993 9
-2 0
-6 0
11 1
-3 3
4 4
12 2
-63 3
-9 6
-8 5
18 8
17 9
-13 10
-51 11
-21 10
-14 11
23 14
18 15
-68 17
-71 17
-37 16
54 13
-35 6
-50 5
56 23
-54 21
-28 16
70 18
-67 24
33 26
15 12
44 20
-571 29
79 19
-89 30
-104 24
-589 21
76 28
-116 31
591 36
-591 33
63 25
-113 37
599 40
-34 29
-74 31
-938 39...

output:

1661

result:

ok single line: '1661'

Test #96:

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

input:

1990 10
-13 0
-7 0
17 1
-28 3
-20 3
26 5
-34 6
-29 6
36 7
-101 9
29 4
-54 9
-56 11
38 8
-178 9
-39 3
10 2
61 12
65 13
49 16
-202 20
-8 17
-87 20
-491 11
-312 19
188 15
108 10
211 21
-51 20
-470 28
-596 19
97 23
321 25
-502 28
477 30
-148 19
-720 9
-203 28
-478 26
-481 27
486 40
-185 32
-837 19
-82 1...

output:

5478

result:

ok single line: '5478'

Test #97:

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

input:

1990 1
-447835 0
-22904 0
451584 1
-1075937 0
-209894 0
1133395 4
-28255892 6
-13465290 3
-19253160 6
-9596010 6
-670730 0
223447 5
-79860 0
-5831053 3
5875037 14
-3064880 0
-28333869 3
-14614820 12
3097823 16
-12462667 19
-104646 0
-9316745 3
-26666671 15
9631409 10
19298046 9
-6947631 12
91358 13
...

output:

4547747

result:

ok single line: '4547747'

Test #98:

score: 29
Accepted
time: 1ms
memory: 11744kb

input:

1992 2
-1136 0
-1858 0
-2221 0
-272 0
-660 0
-1441 0
-3372 0
-232 0
-1958 0
-870 0
-4135 0
-2445 0
-4453 0
-3653 0
-25 0
-974 0
-4395 0
-2344 0
-985 0
-3878 0
-2324 0
-3357 0
-1461 0
-1100 0
-3596 0
2453 12
-3128 0
-2879 0
-1365 0
-287 0
-1416 0
-3034 0
-5070 0
2885 28
-3040 0
-4627 0
-4096 0
-1116 ...

output:

5401

result:

ok single line: '5401'

Test #99:

score: 29
Accepted
time: 1ms
memory: 11868kb

input:

1899 9
-2324 0
2329 1
-4 0
6 3
-77 4
83 5
-8 4
13 7
-9 8
-604 8
15 9
-12 11
-1922 11
614 10
1931 13
17 12
-16 16
17 17
-2484 16
-18 18
-1430 18
26 20
2490 19
-1315 22
-20 22
1438 21
1318 24
22 25
-21 28
29 29
-1543 28
1550 31
-1923 30
-22 30
1930 33
24 34
-24 36
33 37
-954 38
-33 38
958 39
34 40
-41...

output:

2632

result:

ok single line: '2632'

Test #100:

score: 29
Accepted
time: 1ms
memory: 11876kb

input:

1994 1
-1 0
33087 1
-1873 0
26294 3
-45316 4
111450 5
-81782 4
140055 7
-84337 8
102494 9
-127807 8
156520 11
-213104 12
260132 13
-225971 14
-162552 12
-255980 14
228427 16
271795 17
-276631 19
-279249 19
357124 21
291810 20
-289568 22
375973 24
267507 15
-326270 22
393225 27
-341653 28
409817 29
-...

output:

19838070

result:

ok single line: '19838070'

Test #101:

score: 29
Accepted
time: 2ms
memory: 13976kb

input:

1998 23568
-5832 0
82071 1
-53571 0
-547083 2
-584455 2
141858 3
-365528 6
681182 5
-210886 0
-1234196 6
449414 7
-1718551 8
-300025 6
-497177 11
-129044 2
273861 9
359347 13
-4029992 11
-689408 16
-1138509 8
-1059685 17
1175015 20
1281016 10
-14825912 22
4118807 18
-4948702 22
-4503342 22
-2262698 ...

output:

49171083

result:

ok single line: '49171083'

Subtask #5:

score: 31
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #102:

score: 31
Accepted
time: 102ms
memory: 43716kb

input:

299929 7
-109 0
114 1
-140 2
-255 2
-7 0
-228 2
-58 0
229 6
-129 2
135 9
-24 0
-1073 8
-567 8
66 7
144 3
-398 14
-144 2
-65 14
-995 15
11 5
400 16
-1678 21
-1438 21
-231 10
-9 0
-970 10
-633 21
-41 0
-796 15
573 13
18 25
146 17
-17727 30
641 27
797 29
1448 23
-5239 36
-579 15
-7074 34
5245 37
-11547...

output:

339047

result:

ok single line: '339047'

Test #103:

score: 31
Accepted
time: 99ms
memory: 41656kb

input:

299985 1
-2 0
-97 0
-75 0
-160 0
8 1
78 3
-400 6
-149 0
-1010 5
-11374 5
-717 6
-10275 6
-1895 5
-1718 5
-416 6
-6017 5
-11908 5
-5661 5
-1522 6
-197 5
-766 6
-1781 6
-1148 5
-1421 6
-7941 5
-1388 5
-4438 6
-668 5
-561 5
-5219 6
1790 22
770 21
-22969 32
-278325 31
-108733 31
-71264 31
-180441 31
-10...

output:

573363

result:

ok single line: '573363'

Test #104:

score: 31
Accepted
time: 102ms
memory: 41792kb

input:

299900 1
-8761 0
-35508 0
-42416 0
-10619 0
-22187 0
-26605 0
-20428 0
-6109 0
-2039 0
-6893 0
-4556 0
-7621 0
-5271 0
-324 0
-2309 0
-20080 0
-2522 0
-26318 0
-7037 0
-13127 0
-13709 0
-7392 0
-4173 0
-7739 0
-2281 0
-2448 0
-17174 0
-11932 0
-5424 0
-31511 0
-1852 0
-22103 0
-12993 0
-18385 0
-357...

output:

686619

result:

ok single line: '686619'

Test #105:

score: 31
Accepted
time: 106ms
memory: 41692kb

input:

294920 186
-572219451 0
-25786396 0
-50600857 0
-181382446 0
-417131213 0
-593086359 0
-163546308 0
-251114444 0
-290876950 0
-501659564 0
-954809178 0
-324808411 0
-223558100 0
-230214709 0
-160920718 0
-451112478 0
-431099819 0
-100831115 0
-211135272 0
-463974127 0
-749467014 0
-53945636 0
-10392...

output:

43421501

result:

ok single line: '43421501'

Test #106:

score: 31
Accepted
time: 78ms
memory: 41748kb

input:

299702 4
-198246 0
198254 1
-2 0
4 3
-726984 4
-6 4
726985 5
10 6
-263730 8
263736 9
-9 8
18 11
-11 12
-786874 12
16 13
-24 15
-362189 15
29 16
362195 17
786882 14
-25 18
26 21
-155006 18
-30 22
31 24
-800140 25
-31 25
-618474 22
155015 23
800149 26
41 27
-728408 31
728409 32
-40 31
618481 28
49 34
...

output:

581378

result:

ok single line: '581378'

Test #107:

score: 31
Accepted
time: 79ms
memory: 41800kb

input:

299968 7
-4 0
8 1
-9 0
16 3
-18 4
-19 4
28 6
-32 7
25 5
35 8
-35 7
38 11
-38 12
47 13
-43 12
49 15
-57 16
-51 16
65 17
56 18
-65 19
69 21
-69 19
77 23
-80 24
-83 24
83 25
93 26
-97 28
-84 28
98 29
-99 31
-101 31
108 33
-115 34
-108 34
117 35
-120 37
124 38
103 32
116 36
89 30
-124 37
130 43
-130 44
...

output:

376074

result:

ok single line: '376074'

Test #108:

score: 31
Accepted
time: 115ms
memory: 41584kb

input:

295939 1239
-558 0
15088 1
-37167 2
-36977 2
53282 3
-583 0
-165029 5
-44192 5
48797 4
-65843 9
77527 10
169934 7
-483057 11
-101122 9
-216883 12
15823 6
-1133 16
2196 17
494797 13
-41032 18
42518 20
-44678 21
-1075 16
-238587 12
251127 24
45755 22
230385 15
-276125 25
-234323 26
48769 8
109684 14
6...

output:

963570703

result:

ok single line: '963570703'

Test #109:

score: 31
Accepted
time: 57ms
memory: 30744kb

input:

149975 100000
-14832 0
-153686 0
40636 1
-182839 3
202904 4
-212669 3
-60994 0
-487029 3
-212679 5
-242729 3
-65506 3
512192 8
71130 7
171266 2
-170919 14
193351 15
-605254 3
-182431 13
-309249 14
-1363186 12
328537 19
-363871 14
94896 11
-168296 14
-8806 24
620920 17
-1880579 16
-212367 14
-233203 ...

output:

211703481

result:

ok single line: '211703481'

Test #110:

score: 31
Accepted
time: 115ms
memory: 41724kb

input:

299760 1
-88 0
-119 0
124 2
-16 0
-729 0
-33070 3
-6912 3
-21154 3
-58 0
6918 7
-603 0
-379661 10
-154 0
21 4
-577 14
-2069 3
-213181 10
-188584 10
-85 0
-16177 3
-6376 14
-387 0
-44740 3
-14015 14
-23514 3
-58403 14
213188 17
-4535 14
-5748 3
-4336 3
-18568 3
-180 0
-168 0
-14327 14
-47 0
-23438 14...

output:

54797

result:

ok single line: '54797'

Test #111:

score: 31
Accepted
time: 112ms
memory: 43712kb

input:

299986 1
-8300 0
-62409 0
-45079 0
-1915 0
-28386 0
-23754 0
-55670 0
-11172 0
-15809 0
-19302 0
-57559 0
-15299 0
-10370 0
-79660 0
-20628 0
-59031 0
-39466 0
-13053 0
-102263 0
-16709 0
-6688 0
-197 0
-7397 0
-6860 0
-494 0
-54786 0
-2354 0
-747 0
-1336 0
-16250 0
-8610 0
-3 0
-4639 0
-90019 0
-13...

output:

285259

result:

ok single line: '285259'

Test #112:

score: 31
Accepted
time: 119ms
memory: 41664kb

input:

299908 100000
-352081589 0
-118094935 0
-216270665 0
-873442364 0
-365071314 0
-766288699 0
-406636486 0
-638714491 0
-917638104 0
-692544087 0
-57926633 0
-654399438 0
-597497477 0
-770279311 0
-477065649 0
-168399633 0
-248512743 0
-537640128 0
-415385984 0
-94152674 0
-855649529 0
-61682882 0
-55...

output:

665627882

result:

ok single line: '665627882'

Test #113:

score: 31
Accepted
time: 94ms
memory: 43868kb

input:

299951 1
-1 0
7 1
-7 2
-83419 0
-17376 2
83424 4
11 3
17379 5
-39882 7
-9 7
39889 9
17 10
-14 12
20 13
-224333 14
-452935 12
-17 14
452943 16
26 17
224340 15
-335350 19
335360 21
-21 19
26 23
-23 24
-100339 24
100347 26
30 25
-25 28
27 29
-198432 28
-337907 30
-38 30
198440 31
48 33
-39 35
42 36
-46...

output:

418370

result:

ok single line: '418370'

Test #114:

score: 31
Accepted
time: 74ms
memory: 41608kb

input:

299967 1
-1318 0
-1 0
8855 1
-5708 3
-5290 3
3573 2
10491 4
7672 5
-5770 7
11510 9
-6199 7
11013 11
-15892 12
28585 13
-18203 12
21429 15
-34651 16
42576 17
-41820 16
49468 19
-59001 20
68292 21
-73157 22
78572 23
-58491 20
-73745 22
66433 25
76395 26
-84049 28
-77378 28
91024 29
88273 30
-85438 31
...

output:

988536797

result:

ok single line: '988536797'

Test #115:

score: 31
Accepted
time: 55ms
memory: 30200kb

input:

149990 100000
-85023 0
95728 1
-366326 2
377117 3
-99985 2
-96174 0
114707 6
-99952 7
128107 8
-99898 7
-340147 9
-76767 9
367859 11
-794003 4
-55574 12
113100 10
-396105 4
-33521 16
-13551 18
-52853 19
800132 14
-18143 15
-108497 12
122572 5
-482408 24
-1280432 21
485991 25
-15960 19
-519308 27
535...

output:

584477535

result:

ok single line: '584477535'

Test #116:

score: 31
Accepted
time: 99ms
memory: 41700kb

input:

294927 100000
-85868 0
-117401 0
93683 1
-111735 0
-96048 0
-86334 0
98112 5
129646 2
-157955 3
115513 4
-188871 3
-858410 8
-199993 8
-212784 10
-325245 8
332776 15
221086 14
201235 11
-97280 7
-240387 17
-551525 3
-97785 3
108779 19
860341 12
-227549 18
-681915 18
-209694 8
-1113998 24
100582 22
1...

output:

934464929

result:

ok single line: '934464929'

Test #117:

score: 31
Accepted
time: 112ms
memory: 43792kb

input:

299990 7
-21 0
-469 0
-36 0
-251 0
-143 0
-54 0
-55 0
-127 0
-924 0
-134 0
-612 0
-7 0
42 3
-370 0
-1003 0
-9 0
-5670 13
-573 0
-5320 13
-6753 13
-16579 13
27 1
-5764 22
-2121 0
-24910 22
-35557 13
-19636 13
-411 0
-16932 13
-730 0
-373 0
-771 22
-63 0
-2066 22
-2316 13
-30552 22
-12503 22
-21070 13...

output:

187087

result:

ok single line: '187087'

Test #118:

score: 31
Accepted
time: 113ms
memory: 43704kb

input:

299962 100000
-28116828 0
-85128138 0
-95072810 0
-114660808 0
-4511753 0
-19780785 0
-41185690 0
-69740556 0
-2520091 0
-35850160 0
-22167043 0
-79787715 0
-69491168 0
-189100184 0
-129285107 0
-3543142 0
-53593755 0
-19443964 0
-30630591 0
-18655203 0
-7743094 0
-34554295 0
-13029227 0
-1814449 0
...

output:

621887555

result:

ok single line: '621887555'

Test #119:

score: 31
Accepted
time: 102ms
memory: 41660kb

input:

299979 1
-648941 0
-331821 0
-374559 0
-203748 0
-584527 0
-6525 0
-566097 0
-87827 0
-278554 0
-55417 0
-312230 0
-17986 0
-90604 0
-409371 0
-143373 0
-572107 0
-417325 0
-160284 0
-85265 0
-270734 0
-202382 0
-113122 0
-257755 0
-388864 0
-602894 0
-571801 0
-317638 0
-199373 0
-538796 0
-473092 ...

output:

428821

result:

ok single line: '428821'

Test #120:

score: 31
Accepted
time: 92ms
memory: 43628kb

input:

295944 9714
-5408 0
-359900656 0
24022 1
359908576 2
-613750191 3
-9511 3
613756389 5
14850 6
-841527530 8
841532455 9
-9548 8
15489 11
-9563 12
17830 13
-9613 14
14251 15
-772362615 16
772376917 17
-9626 16
-511130828 12
511150175 20
23705 19
-9651 22
-628389093 14
-575533564 22
575542355 25
27616 ...

output:

266471331

result:

ok single line: '266471331'

Test #121:

score: 31
Accepted
time: 78ms
memory: 41640kb

input:

295786 100000
-15069 0
-89569 0
23295 1
105840 2
-89681 4
-98606 4
103597 5
110223 6
-99331 8
102384 9
-99781 8
115903 11
-99902 12
105434 13
-99896 12
-143071 14
103658 15
-131254 14
161212 16
143144 18
-199981 19
-202191 19
219011 22
-202381 23
-208199 23
206705 21
217959 24
218905 25
-211555 28
-...

output:

353935611

result:

ok single line: '353935611'

Test #122:

score: 31
Accepted
time: 101ms
memory: 43756kb

input:

294949 5923
-5504 0
-1493 0
5654 1
-5858 3
-81770 3
4581 2
89138 5
-158309 7
161091 8
13559 4
-5614 6
-93578 7
-5918 10
16389 13
-142436 14
-28503 10
-217057 9
228429 17
-5898 6
-523633 18
33154 16
-345278 9
-90176 21
526127 20
-1376641 24
1388510 25
94132 12
5630 11
155470 15
101682 23
352289 22
18...

output:

575485649

result:

ok single line: '575485649'

Test #123:

score: 31
Accepted
time: 103ms
memory: 43740kb

input:

294920 8899
-8576 0
-8765 0
21184 1
-84568 3
-290888 3
-145417 3
-62 0
87630 4
-430259 8
-982281 3
3338 7
441632 9
-11904711 12
-7986 11
993403 10
-3920379 15
-1443635 8
148735 6
-79565 11
-583139 11
-2083 0
-2132977 15
13592 14
-190451 3
-338182 11
13111 21
-124984 26
-5453 0
-7825 26
-301036 26
-1...

output:

968246220

result:

ok single line: '968246220'

Test #124:

score: 31
Accepted
time: 112ms
memory: 43780kb

input:

298400 5
-120 0
-350 0
-17 0
-241 0
-21 0
-738 0
-54 0
-129 0
360 2
-29326 9
-108 0
-11 0
-334 0
-15408 9
131 8
-6253 15
-475 0
-21786 9
-6736 15
-58896 9
-36827 15
-18 0
-282 0
290 23
-56597 24
-1945 15
-4 0
-20 0
246 4
-9342 29
-25451 24
-62593 15
-15432 29
-28163 9
-357 0
-9424 24
-16370 29
-1339...

output:

272416

result:

ok single line: '272416'

Test #125:

score: 31
Accepted
time: 123ms
memory: 41660kb

input:

299989 18493
-3482730 0
-2495685 0
-4860756 0
-367042 0
-2189247 0
-412987 0
-6934200 0
-2273836 0
-305639 0
-2949779 0
-16567 0
-4140444 0
-685363 0
-7781402 0
-1169170 0
-5349146 0
-2907703 0
-4115283 0
-734919 0
-1173030 0
-3209380 0
-866898 0
-10728680 0
-1635091 0
-6882920 0
-3380039 0
2962588 ...

output:

987827892

result:

ok single line: '987827892'

Test #126:

score: 31
Accepted
time: 103ms
memory: 41744kb

input:

299906 9450
-23831565 0
-186084705 0
-51140751 0
-242692108 0
-409157424 0
-799290155 0
-906468238 0
-98029627 0
-843293108 0
-860607755 0
-239039254 0
-593435467 0
-726714543 0
-316887666 0
-142299442 0
-526297141 0
-193042351 0
-270483608 0
-603100149 0
-791672212 0
-460611753 0
-188402824 0
-5361...

output:

354400168

result:

ok single line: '354400168'

Test #127:

score: 31
Accepted
time: 57ms
memory: 31084kb

input:

183275 1
-313643872 0
313659906 1
-1 0
35647 3
-246507643 4
-7318 4
246523149 5
28155 6
-36345686 8
36348404 9
-25587 8
27569 11
-245994120 12
-33637 12
246037815 13
66352 14
-263661579 16
-50297 16
69291 18
263704227 17
-10768531 19
10795092 21
-63221 19
99822 23
-66529 24
-185319899 24
185349473 2...

output:

412880867

result:

ok single line: '412880867'

Test #128:

score: 31
Accepted
time: 30ms
memory: 30696kb

input:

133433 4222
-3986 0
5976 1
-4061 2
-4111 2
21001 4
-48554 5
17198 3
71309 6
-3722 0
26017 9
-51606 5
66421 11
-63196 12
-58343 12
85690 14
71616 13
-86716 16
97559 17
-64170 16
-114061 18
86543 19
-105555 18
121754 20
-119923 23
121166 22
-124074 23
131894 26
139688 24
-204401 27
213806 29
-204833 2...

output:

743076160

result:

ok single line: '743076160'

Test #129:

score: 31
Accepted
time: 105ms
memory: 41668kb

input:

299946 100000
-94472 0
94481 1
-100004 2
-50598 0
50602 4
-97496 5
-99999 5
97497 6
-96551 2
100008 7
-100009 8
-100001 10
100011 3
96557 9
-100002 14
100003 12
-100010 8
-100000 10
100011 17
-100085 13
100009 15
100011 11
-100187 19
100195 23
-100008 13
-100048 21
-100078 16
-100011 16
-100021 19
-...

output:

552128

result:

ok single line: '552128'

Test #130:

score: 31
Accepted
time: 104ms
memory: 43648kb

input:

299904 100000
-88149 0
88152 1
-99245 0
99247 3
-100064 2
-99840 0
-100005 4
-100120 4
99841 6
-100050 2
100130 8
100008 7
-100098 4
100051 10
-100169 9
-100013 9
-100000 2
-100127 9
-100496 14
100135 18
-100148 20
-100615 14
-100281 11
-101896 12
-97783 0
-100301 14
100501 19
-100717 11
100103 13
1...

output:

527049

result:

ok single line: '527049'

Test #131:

score: 31
Accepted
time: 99ms
memory: 43616kb

input:

294954 1
-158046 0
164570 1
-79713 0
-1029494 2
-264364 0
-98672 0
1036632 4
-88669 0
-4355786 2
-655927 2
-474725 2
-419515 0
-131706 0
-598754161 7
-184794098 7
-246991 0
-478173636 7
-148145644 7
-103646015 7
-271067945 7
-89792536 7
-182351 0
-128055 0
-1 0
-64105873 7
257892 16
-484581 2
-19719...

output:

387900130

result:

ok single line: '387900130'

Test #132:

score: 31
Accepted
time: 116ms
memory: 41604kb

input:

299982 8
-3966 0
-665 0
-46331 0
-51416 0
-4909 0
-64388 0
-82145 0
-16735 0
-14523 0
-6358 0
-3535 0
-24039 0
-33022 0
-78158 0
-1551 0
-14253 0
-593 0
-105792 0
-57098 0
-7031 0
-5289 0
-261 0
-11696 0
-82178 0
-15566 0
-14859 0
-3931 0
-41174 0
-1741 0
-62165 0
-80949 0
-19610 0
-46274 0
-16703 0...

output:

229592

result:

ok single line: '229592'

Test #133:

score: 31
Accepted
time: 108ms
memory: 43708kb

input:

299945 1
-732914 0
-306695 0
-204305 0
-123569 0
-576065 0
-63482 0
-116301 0
-234308 0
-371756 0
-561419 0
-32071 0
-443459 0
-168285 0
-557068 0
-352934 0
-172790 0
-726987 0
-81598 0
-47719 0
-547222 0
-592448 0
-120200 0
-23346 0
-60035 0
-249744 0
-653065 0
-338046 0
-800109 0
-644522 0
-264497...

output:

365421

result:

ok single line: '365421'

Test #134:

score: 31
Accepted
time: 89ms
memory: 43792kb

input:

299906 1
-133017 0
-1 0
7 2
-620976 3
-5 3
133018 1
12 5
620983 4
-6 7
-325597 7
16 9
-7 11
-195529 11
325599 10
195531 13
15 12
-157626 16
157633 17
-9 16
10 19
-70935 20
-12 20
22 22
-231107 23
70944 21
-14 23
23 26
-135925 27
-18 27
231113 24
21 29
135933 28
-22 31
-155481 31
27 33
-24 35
155485 ...

output:

602998

result:

ok single line: '602998'

Test #135:

score: 31
Accepted
time: 83ms
memory: 41820kb

input:

299917 100000
-50021 0
50024 1
-54932 2
-76639 2
-20021 0
54942 3
76646 4
-94951 7
20025 5
-99141 7
94961 8
99146 10
-99275 12
99277 13
-99405 12
99413 15
-99814 16
-99782 16
99785 18
99819 17
-99904 20
99905 21
-99823 20
99830 23
-99951 22
99960 25
-99969 22
99977 27
-99975 28
-99997 28
99976 29
10...

output:

401224

result:

ok single line: '401224'

Test #136:

score: 31
Accepted
time: 111ms
memory: 43776kb

input:

299996 12714
-16745 0
22805 1
-113953 2
-68514 2
-4079 0
72579 4
-133925 6
8394 5
-24851 8
-37637 2
-276558 6
47617 10
-289789 6
-70221 12
-53963 8
29511 9
-241364 16
-580104 12
250464 17
-97070 16
-1312338 19
1315377 21
586677 18
75992 14
-172337 24
-754691 19
-174410 16
185745 27
-2955774 22
-1117...

output:

983773021

result:

ok single line: '983773021'

Test #137:

score: 31
Accepted
time: 99ms
memory: 43736kb

input:

294902 1
-22128 0
22346 1
-1 0
2256 3
-3645 4
15789 5
-24375 2
-2057 4
31550 7
-42507 9
-37490 9
38354 11
-38550 12
47313 10
51063 13
11909 8
-71267 6
-56951 12
57722 18
-85685 14
96284 20
-29808 16
-192731 19
82647 17
-94398 21
192853 23
103147 25
-295116 26
-267089 19
-108545 27
-129506 24
-58762 ...

output:

65235316

result:

ok single line: '65235316'