QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96535#360. Cultivationtricyzhkx55 76ms4732kbC++142.6kb2023-04-14 10:42:292023-04-14 10:42:31

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-14 10:42:31]
  • 评测
  • 测评结果:55
  • 用时:76ms
  • 内存:4732kb
  • [2023-04-14 10:42:29]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
void chkmax(int &a,int b){a=max(a,b);}
void chkmin(int &a,int b){a=min(a,b);}
struct Point
{
	int x,y;
	bool operator<(const Point &a)const{return x<a.x;}
}a[310];
int H,W,n,p[610],L[310],R[310],pre[610],mny[610],mxy[610],mxd[610],len[100010],miny[310][310],maxy[310][310],maxd[310][310];
ll ans=1e18;
multiset<int> st;
template<class cmp>
struct Que
{
	cmp _cmp;
	int le,ri;
	pii que[610];
	void clear(){le=ri=0;}
	void push(pii x)
	{
		while(le<ri && _cmp(que[ri-1],x)) ri--;
		que[ri++]=x;
	}
	void pop(int x){while(le<ri && que[le].second<x) le++;}
	bool empty(){return le>=ri;}
	int top(){return que[le].first;}
};
Que<less<pii>> Q1,Q3;
Que<greater<pii>> Q2;
void solve(int len)
{
	int t1=0,t2=0;
	for(int i=1;i<=n;i++) L[i]=a[i].x,R[i]=L[i]+len;
	for(int i=1;i<=n;i++) p[++t1]=L[i];
	t2=t1;
	for(int i=1;i<=n;i++) p[++t2]=R[i];
	inplace_merge(p+1,p+t1+1,p+t2+1);
	t2=unique(p+1,p+t2+1)-p-1;
	for(int i=1,j=1,k=1;i<=n;i++)
	{
		for(;p[j]<L[i];j++);
		for(;p[k]<R[i];k++);
		L[i]=j;R[i]=k;
	}
	for(int i=1,j=1,k=0;i<=t2;i++)
	{
		for(;j<=n && R[j]<=i;j++);
		for(;k<n && L[k+1]<=i;k++);
		pre[i]=pre[i-1];
		if(j>k){pre[i]++;continue;}
		mny[i]=miny[j][k];mxy[i]=maxy[j][k];mxd[i]=maxd[j][k];
	}
	Q1.clear();Q2.clear();Q3.clear();
	for(int i=1,j=1;i<R[1];i++)
	{
		for(;j<=t2 && p[j]<=p[i]+H-1;j++)
			if(pre[j]==pre[j-1])
				Q1.push({mny[j],j}),Q2.push({mxy[j],j}),Q3.push({mxd[j],j});
		Q1.pop(i);Q2.pop(i);Q3.pop(i);
		if(pre[j-1]==pre[i-1] && !Q1.empty() && !Q2.empty() && !Q3.empty())
			ans=min(ans,(ll)len+max(Q1.top()+W-Q2.top(),Q3.top())-2);
	}
}
int main()
{
	cin>>H>>W>>n;
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i].x,&a[i].y);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		miny[i][i-1]=1e9;maxy[i][i-1]=-1e9;
		st.clear();st.insert(0);st.insert(W+1);
		for(int j=i;j<=n;j++)
		{
			st.insert(a[j].y);
			miny[i][j]=min(miny[i][j-1],a[j].y);
			maxy[i][j]=max(maxy[i][j-1],a[j].y);
		}
		for(auto it=st.begin();it!=st.end();it++)
			if(next(it)!=st.end()) chkmax(maxd[i][n],*next(it)-*it);
		for(int j=n;j>i;j--)
		{
			auto it=st.find(a[j].y);
			it=st.erase(it);
			maxd[i][j-1]=max(maxd[i][j],*it-*prev(it));
		}
	}
	int tot=0;
	for(int i=1;i<=n;i++)
		for(int j=i;j<=n;j++)
			if(a[i].x<a[j].x) len[++tot]=a[j].x-a[i].x;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			len[++tot]=a[i].x+H-a[j].x;
	sort(len+1,len+tot+1);
	tot=unique(len+1,len+tot+1)-len-1;
	for(int i=1;i<=tot;i++) solve(len[i]);
	cout<<ans<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3740kb

input:

2 4
2
1 1
1 4

output:

3

result:

ok single line: '3'

Test #2:

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

input:

4 1
1
2 1

output:

3

result:

ok single line: '3'

Test #3:

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

input:

3 3
3
1 2
1 3
3 3

output:

3

result:

ok single line: '3'

Test #4:

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

input:

2 2
1
1 2

output:

2

result:

ok single line: '2'

Test #5:

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

input:

4 4
10
4 2
2 3
2 4
4 1
1 2
2 1
4 3
3 3
3 1
1 4

output:

2

result:

ok single line: '2'

Test #6:

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

input:

4 4
1
4 1

output:

6

result:

ok single line: '6'

Test #7:

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

input:

4 4
3
2 2
3 3
1 4

output:

5

result:

ok single line: '5'

Test #8:

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

input:

4 4
15
4 3
2 4
4 4
4 1
3 3
1 2
3 1
2 1
3 4
3 2
4 2
2 3
1 3
2 2
1 4

output:

1

result:

ok single line: '1'

Test #9:

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

input:

4 3
3
2 1
2 3
4 1

output:

3

result:

ok single line: '3'

Test #10:

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

input:

4 4
2
3 4
2 4

output:

5

result:

ok single line: '5'

Test #11:

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

input:

2 4
1
1 2

output:

4

result:

ok single line: '4'

Test #12:

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

input:

3 3
4
2 1
1 1
3 2
3 1

output:

2

result:

ok single line: '2'

Test #13:

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

input:

3 4
3
1 4
3 3
3 4

output:

4

result:

ok single line: '4'

Test #14:

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

input:

3 3
2
2 1
3 3

output:

4

result:

ok single line: '4'

Test #15:

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

input:

4 4
2
2 4
3 1

output:

6

result:

ok single line: '6'

Test #16:

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

input:

4 4
3
2 2
2 1
4 2

output:

4

result:

ok single line: '4'

Subtask #2:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Test #17:

score: 10
Accepted
time: 2ms
memory: 3492kb

input:

15 15
20
6 13
14 4
11 13
15 3
12 4
10 4
11 6
8 9
12 12
2 15
4 3
8 15
8 4
3 1
5 10
11 12
8 7
13 10
11 4
1 3

output:

13

result:

ok single line: '13'

Test #18:

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

input:

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

output:

9

result:

ok single line: '9'

Test #19:

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

input:

36 38
28
30 5
4 23
29 20
1 36
8 28
8 9
5 26
23 16
26 1
24 38
22 36
4 26
9 7
10 24
20 11
31 5
24 30
26 30
18 15
14 1
23 31
20 7
23 30
33 9
27 33
8 7
9 16
33 5

output:

30

result:

ok single line: '30'

Test #20:

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

input:

10 40
19
7 5
8 38
4 7
8 5
4 30
1 33
1 16
2 21
8 33
4 36
6 20
6 27
4 14
10 15
9 30
8 13
4 15
10 9
5 22

output:

17

result:

ok single line: '17'

Test #21:

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

input:

40 30
50
19 20
18 16
34 28
5 8
28 21
24 13
7 1
28 23
28 18
12 6
3 6
18 8
40 27
22 19
23 22
8 6
9 12
16 10
27 25
26 19
4 9
40 26
21 22
10 8
5 2
30 25
12 12
3 1
24 14
5 3
4 8
19 9
21 16
6 3
38 29
27 20
37 25
36 24
22 20
29 26
30 19
16 14
3 3
39 25
5 7
20 15
13 12
33 30
27 16
25 14

output:

50

result:

ok single line: '50'

Test #22:

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

input:

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

output:

16

result:

ok single line: '16'

Test #23:

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

input:

40 40
33
10 22
10 3
7 11
12 14
11 12
1 21
6 23
3 11
8 24
3 40
8 14
7 25
8 15
12 3
10 7
4 32
7 32
9 32
9 30
4 22
8 22
11 24
6 19
10 16
10 2
9 4
10 15
9 28
7 1
4 31
7 35
4 18
2 35

output:

46

result:

ok single line: '46'

Test #24:

score: 0
Accepted
time: 4ms
memory: 4732kb

input:

40 40
200
10 16
27 15
18 11
16 25
34 7
39 25
26 15
12 20
8 1
20 14
25 27
33 4
29 40
20 33
8 9
32 16
37 25
34 27
31 23
30 8
40 30
35 37
27 7
18 27
36 30
13 30
12 32
32 4
15 21
29 39
4 32
8 7
12 21
35 40
32 29
34 17
22 30
12 34
34 39
23 16
27 16
13 26
28 32
8 31
30 16
13 25
28 13
19 35
38 35
2 40
7 1
...

output:

14

result:

ok single line: '14'

Test #25:

score: 0
Accepted
time: 5ms
memory: 4304kb

input:

40 40
150
8 38
27 32
34 14
29 32
16 36
29 19
40 30
30 22
34 12
4 30
24 37
14 8
31 21
40 17
38 25
16 5
29 5
38 29
28 10
2 5
5 16
20 11
38 6
21 11
5 8
26 13
21 35
27 27
10 11
18 30
30 40
8 18
31 5
16 7
3 1
35 36
40 26
18 39
25 8
19 16
17 26
6 20
13 30
34 4
35 8
33 4
25 29
39 7
22 40
10 36
26 3
30 14
1...

output:

16

result:

ok single line: '16'

Test #26:

score: -10
Runtime Error

input:

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

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 30
Accepted

Test #45:

score: 30
Accepted
time: 1ms
memory: 3480kb

input:

1000000000 1000000000
17
822413671 70423910
260075513 431043546
300945721 793553248
142848049 163787897
392462410 831950868
699005697 111397300
444396260 130450496
642691616 595456084
467968916 463598810
159764248 611476406
929313754 539645102
365153650 964108073
906780716 373514044
970118116 655138...

output:

852626202

result:

ok single line: '852626202'

Test #46:

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

input:

1000000000 1000000000
24
382358372 812500277
617637090 687506454
441176760 562497727
382346048 687504690
205880053 312504652
794110577 62497634
264714161 937490675
970587944 812502893
617647581 62504110
852944701 812498007
88227293 187492617
558814156 687495577
29403236 812494493
911761865 187491781...

output:

904419459

result:

ok single line: '904419459'

Test #47:

score: 0
Accepted
time: 4ms
memory: 3664kb

input:

1000000000 1000000000
25
59999964 299999989
740000035 100000111
139999972 499999797
740000159 899999809
940000104 899999905
459999870 299999853
139999925 899999750
260000183 300000150
260000200 699999915
940000072 99999821
340000223 900000130
739999776 499999813
59999984 700000029
539999767 90000023...

output:

480000793

result:

ok single line: '480000793'

Test #48:

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

input:

1000000000 1000000000
25
496770868 499466029
150245306 140351260
443861207 442170127
915815913 907024280
592352731 580300173
614771420 602707761
545759771 564678204
790963611 795646738
466306333 474998682
700037062 710428701
326403486 341417980
13108429 18468915
296795338 282907012
207909366 2192548...

output:

1967193239

result:

ok single line: '1967193239'

Test #49:

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

input:

1000000000 1000000000
25
508699723 917649746
972134563 24654272
591574312 768222747
342111766 678842208
280650655 335101574
112108587 538128714
232733100 741988808
569340416 313541403
333183415 646381341
348331220 239049882
321253252 46884019
458715217 456559440
11396102 588839952
212356188 55359081...

output:

967430445

result:

ok single line: '967430445'

Test #50:

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

input:

1000000000 1000000000
25
87500002 928571428
712500002 71428571
212500002 71428570
837500001 71428573
912499999 214285715
287500002 785714285
37500003 785714285
962500002 357142856
787500000 785714288
787500003 500000003
462500002 71428570
462500001 357142859
37499999 500000000
462500002 642857144
37...

output:

660714282

result:

ok single line: '660714282'

Test #51:

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

input:

1000000000 1000000000
25
499999999 565789472
499999990 250000002
499999996 749999995
499999999 144736850
499999993 513157893
499999992 644736853
500000010 13157889
499999998 118421056
499999993 197368414
499999990 592105269
499999994 486842107
500000005 276315783
499999994 539473685
499999990 618421...

output:

1131578975

result:

ok single line: '1131578975'

Test #52:

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

input:

999999999 777777777
25
777772259 317438734
467526694 324943812
750092374 316807230
351488629 328182224
670366487 319838016
194662876 330078646
807706262 316391102
682779230 318750710
529347725 323684686
437218310 325726470
284055780 328324426
156380921 332766879
754204172 318252081
631742119 3197068...

output:

1086358403

result:

ok single line: '1086358403'

Test #53:

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

input:

100000000 1000000000
25
75997424 820728673
777782 777777776
777783 777777777
777780 777777778
18626903 845305698
32700264 518597334
66223561 813120928
92237121 497548369
66359837 477082113
51360029 493816356
777776 777777775
777778 777777776
77907935 347786430
777776 777777776
777779 777777786
77777...

output:

434734665

result:

ok single line: '434734665'

Test #54:

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

input:

1000000000 1000000000
25
202384720 191386798
272784910 876112960
134295596 689831109
144607550 725288401
304962179 141608855
184056836 214149818
580684614 928741905
339656490 906353399
222518718 825019927
65386126 415917878
836363213 211099284
885557581 342429798
772605154 167160669
750597218 865168...

output:

1169492481

result:

ok single line: '1169492481'

Test #55:

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

input:

1000000000 1000000000
25
217898725 381443931
363716745 553078122
741451918 906975033
153568070 900704450
12302872 385341608
276235760 349179186
221511192 438759684
177246208 108385423
157609379 88135252
542559523 122476619
676920172 289023879
132864371 527493734
980440215 892433157
465353007 9681278...

output:

936384704

result:

ok single line: '936384704'

Test #56:

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

input:

1000000000 1000000000
25
108777360 996968244
655575871 74556270
426116462 624297074
601010849 48108108
411143918 863537296
176018437 125264437
769284398 653206473
823951690 375380635
675138657 124417631
305117857 433890179
878598110 72028431
322847356 902439915
323815174 873868901
575209775 37455562...

output:

603034352

result:

ok single line: '603034352'

Test #57:

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

input:

335563010 332545567
25
106441293 332545567
117303130 332545567
335563010 272104540
335563010 47336793
335563010 171741328
315104367 332545567
335563010 258033462
174568335 332545567
170964494 332545567
335563010 68594399
304935196 332545567
97310526 332545567
99941575 332545567
12373018 332545567
33...

output:

389908846

result:

ok single line: '389908846'

Test #58:

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

input:

1000000000 1000000000
25
786394982 791216768
119431195 847633609
81087720 1
264330507 432964753
737246186 427050407
922213406 555980523
550982306 581735630
1 1
852080288 1
1 538609505
375220500 773780706
182457491 294843990
1 634980243
421417169 1
253676052 1
601408832 610485554
957268112 249030717
...

output:

905880429

result:

ok single line: '905880429'

Test #59:

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

input:

1000000000 999999999
25
123456824 987654308
123456819 987654326
123456769 987654289
123456790 987654288
123456802 987654292
123456810 987654352
123456754 987654338
123456799 987654354
123456821 987654331
123456812 987654344
123456754 987654308
123456771 987654347
123456759 987654325
123456794 987654...

output:

1999999906

result:

ok single line: '1999999906'

Test #60:

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

input:

800000000 850000000
25
335835504 189725436
12182937 480593240
63284654 46903085
328812657 436279057
477372871 828400687
194405795 653579540
710586790 72905770
723953376 117573812
64734838 462492145
171374113 120671772
209599317 71273938
194054608 171593430
167629250 52680425
14966053 566230223
12058...

output:

802951025

result:

ok single line: '802951025'

Test #61:

score: 0
Accepted
time: 4ms
memory: 3664kb

input:

1000000000 1000000000
25
62157117 656205518
713439094 288906525
164961619 102056326
876566497 377063232
495641022 967020329
945382229 113881584
172072381 293104404
486897712 389281101
737647745 678839821
248637273 650807852
952485639 634170837
833476502 432041466
148863447 117321892
496035975 546217...

output:

922368183

result:

ok single line: '922368183'

Test #62:

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

input:

1000000000 1000000000
25
499999980 343399132
499999906 225597526
500000007 861547250
499999909 461896002
500000078 691034441
499999919 222514427
499999978 236039953
500000027 612489620
500000050 614406498
500000052 169059154
500000075 102616793
500000005 334144037
500000097 500336043
499999996 14731...

output:

1241069609

result:

ok single line: '1241069609'

Test #63:

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

input:

1000000000 1000000000
25
642065222 981136342
121675139 261963018
735944627 576109400
338153502 307800112
679432262 331837809
40070650 210942580
817625196 535344408
789427854 731652674
774571963 608761006
114198549 290605105
755781608 320483327
257969748 129605173
627155257 309519841
485229109 512450...

output:

939246082

result:

ok single line: '939246082'

Test #64:

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

input:

1000000000 1000000000
25
611076895 363884544
439305553 342413208
438525493 342315624
208146420 313518360
433276048 341659421
891567968 398946036
554628049 356828591
182192780 310274086
713718510 376714855
248891223 318611451
184804702 310600627
197198331 312149761
834859186 391857364
737551904 37969...

output:

1379296760

result:

ok single line: '1379296760'

Subtask #5:

score: 20
Accepted

Dependency #4:

100%
Accepted

Test #65:

score: 20
Accepted
time: 40ms
memory: 4184kb

input:

1000000000 1000000000
100
687499990 187500017
691054532 301146309
937499988 312500002
687499994 937500007
579878939 781071766
187500018 562500000
187500009 937500018
562499999 562500008
562499985 687499991
562500019 937500016
62499982 562499999
937500012 812500017
62499989 687500003
812499999 937500...

output:

250000064

result:

ok single line: '250000064'

Test #66:

score: 0
Accepted
time: 60ms
memory: 4184kb

input:

1000000000 1000000000
100
542839344 460784175
764577804 73469018
973053355 582110240
227275321 887279728
877462957 6335451
123071062 183008573
75817935 385158033
531903085 153788001
567541302 401895176
684722196 789303723
859433169 221358091
265925767 758747732
801564400 623065017
813697484 56178464...

output:

443169563

result:

ok single line: '443169563'

Test #67:

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

input:

1000000000 1000000000
100
441418843 100271521
447977823 105427459
445102973 99698689
450318271 892850747
441382754 104692662
444894142 891456864
445508202 92700655
438105177 99180605
449203792 890578392
450212270 96714613
443535131 887141139
443955088 98197899
443858332 892648803
443973287 95210209
...

output:

1772795142

result:

ok single line: '1772795142'

Test #68:

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

input:

1000000000 1000000000
100
889156435 714438618
889336408 715294191
888939803 715213403
99924877 744916962
889209500 715138550
888803546 714984297
889117445 714588559
888991575 715053554
888715509 715011760
889190571 714877644
888866677 715230384
889175860 714939055
888533104 715170413
888882048 71528...

output:

1817622448

result:

ok single line: '1817622448'

Test #69:

score: 0
Accepted
time: 64ms
memory: 4180kb

input:

1000000000 1000000000
100
700015829 795702538
841987573 597503842
864879088 817375719
290149922 819983410
525506660 60963665
867074117 382441617
556493999 830774423
193560596 616455758
706396769 403076992
852912726 705506780
10222864 118710353
927780780 554649635
512547641 663935246
11968287 5685054...

output:

469662017

result:

ok single line: '469662017'

Test #70:

score: 0
Accepted
time: 24ms
memory: 4164kb

input:

900000000 800000000
100
539328722 46933087
1 346231212
7996497 1
319791651 800000000
540027394 800000000
15682268 800000000
65965842 752502190
1 94613470
341707243 800000000
604531347 1
662868480 1
842989035 800000000
447334492 1
747654645 800000000
1 395951805
376289914 54497461
900000000 181873065...

output:

695557539

result:

ok single line: '695557539'

Test #71:

score: 0
Accepted
time: 61ms
memory: 3924kb

input:

1000000000 1000000000
100
576019722 576731254
34534933 41532354
312314245 314683319
785390133 783036403
702745349 699472167
561033586 568534716
983913351 967266069
637833123 630909512
118291167 118507843
775681461 786122038
340629086 351626639
234556649 237767341
777128793 778128856
857203596 861263...

output:

1966119009

result:

ok single line: '1966119009'

Test #72:

score: 0
Accepted
time: 65ms
memory: 3996kb

input:

1000000000 1000000000
100
928726043 764696650
375580170 418961839
371082575 132195766
867406178 756269836
653572760 38349187
686531294 398976045
48971801 719850555
993778576 4599956
843584800 678738510
98689299 840256129
989208023 741632477
462911847 443376132
160038550 890566730
765304836 455418643...

output:

476666857

result:

ok single line: '476666857'

Test #73:

score: 0
Accepted
time: 63ms
memory: 4028kb

input:

1000000000 1000000000
100
855090718 688743004
656729697 988798850
355808853 386266222
341590297 423952911
156130053 756093340
850385829 149630244
858212777 287892688
359305700 682324504
159865123 815937328
143876512 185691060
146370821 599761929
648804157 621881128
344064714 309618221
858715171 9513...

output:

459823110

result:

ok single line: '459823110'

Test #74:

score: 0
Accepted
time: 76ms
memory: 3848kb

input:

1000000000 1000000000
100
726843076 10351859
879584139 373974016
267852562 286736200
195897212 829647899
715832751 875977818
256939347 275942632
958681194 351640246
270998650 667371737
875265447 325319774
201342012 734623861
891268004 4380005
584955939 236756645
81478727 440361456
74399820 988266596...

output:

585564003

result:

ok single line: '585564003'

Test #75:

score: 0
Accepted
time: 68ms
memory: 3936kb

input:

1000000000 1000000000
100
302873638 802518331
747916007 292283372
33204420 608466457
181499312 656928875
477590903 829513066
294341038 191147120
62798904 934216151
805380371 18054353
626190333 400064953
583470503 299444677
61994876 946533850
910863880 13769746
255232847 874165619
894912702 619240949...

output:

441778875

result:

ok single line: '441778875'

Test #76:

score: 0
Accepted
time: 63ms
memory: 3924kb

input:

1000000000 1000000000
100
236566110 841588240
681365516 361560437
935140887 787880578
697623224 646531137
928787811 574232374
753948476 564133161
729408758 49489242
134648810 601310133
247857070 547588190
99310384 1
762083013 896494859
180155077 424178075
798198008 732288381
631034756 234183726
3838...

output:

521454223

result:

ok single line: '521454223'

Test #77:

score: 0
Accepted
time: 60ms
memory: 4192kb

input:

1000000000 1000000000
100
407924149 158482998
415653252 313065009
414573396 291467995
404592394 91848000
407887995 157760009
448507142 970142998
434054396 681087995
426407950 528159006
413020058 260400991
444243391 884867999
425548649 510972996
430696943 613939011
440650400 813007998
417158698 34317...

output:

1100915441

result:

ok single line: '1100915441'

Test #78:

score: 0
Accepted
time: 64ms
memory: 3784kb

input:

1000000000 1000000000
100
701998381 577124106
461439742 586008343
249356290 589118161
864208917 557567966
914931852 523146821
815537467 572000631
709526887 548834485
358235176 576942817
715074556 556481868
425174418 585446103
699181337 541462104
345211883 601918838
524645242 593291133
663191990 5779...

output:

1165842671

result:

ok single line: '1165842671'

Test #79:

score: 0
Accepted
time: 63ms
memory: 4184kb

input:

1000000000 1000000000
100
862711011 601927729
332635154 545321423
362241452 587307633
30116310 749597564
108582181 678550664
637474925 616430433
784359776 507999280
666869305 572184078
87637252 704457737
608134832 664285946
744635776 500682999
589132939 692882132
489742075 745400199
725204188 508695...

output:

1200231273

result:

ok single line: '1200231273'

Test #80:

score: 0
Accepted
time: 64ms
memory: 4164kb

input:

1000000000 1000000000
100
323283210 323625382
323146201 539174425
749914073 431427761
499953095 294163192
676735265 441216105
323280988 950941540
676800293 911723177
676863159 421639904
676776904 519566414
249932831 862836353
323167901 166751639
499910407 333269241
750071818 196099488
499971585 6470...

output:

637550138

result:

ok single line: '637550138'

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%