QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#735761#9610. 游戏xyz123100 ✓1364ms358240kbC++234.8kb2024-11-11 21:35:182024-11-11 21:35:20

Judging History

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

  • [2024-11-11 21:35:20]
  • 评测
  • 测评结果:100
  • 用时:1364ms
  • 内存:358240kb
  • [2024-11-11 21:35:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
long long a,b,c,q,w,sum[200005],cn,lim=5000000;
long long an1[10000005];
unsigned long long ann[10000005],an[10000005],ans;
long long sm1[10000005],sm2[10000005];
int d[5000005],v[5000005],cnn;
inline int read(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}return x*f;}
struct p{long long l,r;}l[200005];
void ins(int ll,int rr,long long q1,long long q2)
{
	if(ll>rr) return;
	sm1[ll]+=q1,sm1[rr+1]-=q1;
	sm2[ll]+=q2,sm2[rr+1]-=q2;
}
int main()
{
	a=read(),b=read(),c=read();
	for(int i=1;i<=a;i++) q=read(),w=read(),v[q]++,v[w+1]--;
	for(int i=1;i<=lim;i++) v[i]+=v[i-1];
	for(int i=1;i<=lim;i++)
	{
		if(v[i]) d[++cnn]=i;
	}
	sum[0]=0;
	for(int i=0;i<=lim;i++) an[i]=0;
	for(int i=cnn;i>=1;i-=2) an[lim]+=d[i];
	long long la=1;cn=0;
	for(int i=2;i<=cnn;i++)
	{
		if(d[i]!=d[i-1]+1) l[++cn]=p{d[la],d[i-1]},la=i;
	}l[++cn]=p{d[la],d[cnn]};
	for(int i=1;i<=cn;i++) sum[i]=sum[i-1]+l[i].r-l[i].l+1;
	for(int i=0;i<=lim*2;i++) sm1[i]=sm2[i]=0;
	if(c==1)
	{
		for(int i=1;i<=cn;i++)
		{
			for(int j=i+1;j<=cn;j++)
			{
				if((sum[j-1]-sum[i]+l[j].l-l[i].r)%2==0)
				{
					long long l1=l[i].l,r1=l[i].r,l2=l[j].l,r2=l[j].r;
					if((r1+l2)%2==0)
					{
						long long tt=r1+l2;
						long long L=max(l1,l2+r1-r2),R=r1;
						if(L<=R)
						{
							an1[tt-1]-=(R-L+1)*(R+L)-tt*(R-L+1);
							an1[tt+1]+=(R-L+1)*(R+L)-tt*(R-L+1);
						}
					}
					long long R=min(l1+r2,r1+l2);
					ins(l1+l2,R,-(l1+l2-1)*(l1-l2),(l1-l2));
					ins(R+1,r1+l2,-(r2-l2+1)*(r2+l2),(r2-l2+1));
				}
			}
		}
		for(int i=1;i<=lim*2;i++)
		{
			sm1[i]+=sm1[i-1];sm2[i]+=sm2[i-1];
			if(i%2==0) an1[i-1]+=sm1[i]+sm2[i]*i;
			else an1[i-1]-=sm1[i]+sm2[i]*i;
		}
		for(int i=0;i<=lim*2;i++) sm1[i]=sm2[i]=0;
		for(int i=1;i<=cn;i++)
		{
			for(int j=i+1;j<=cn;j++)
			{
				if((sum[j-1]-sum[i]+l[j].l-l[i].r)%2==0)
				{
					long long l1=l[i].l,r1=l[i].r,l2=l[j].l,r2=l[j].r;
					long long L=max(r1+l2,l1+r2);
					ins(r1+l2+1,L,(l1-r1-1)*(-r1-l1),(l1-r1-1));
					ins(L+1,r1+r2,(r2+r1+1)*(r1-r2),(-r1+r2));
				}
			}
		}
		for(int i=1;i<=lim*2;i++)
		{
			sm1[i]+=sm1[i-1];sm2[i]+=sm2[i-1];
			if(i%2==0) an1[i+1]+=sm1[i]+sm2[i]*i;
			else an1[i+1]-=sm1[i]+sm2[i]*i;
		}
		for(int i=0;i<=lim*2;i++) sm1[i]=sm2[i]=0;
		for(int i=1;i<=cn;i++)
		{
			for(int j=i+1;j<=cn;j++)
			{
				if((sum[j-1]-sum[i]+l[j].l-l[i].r)%2==1)
				{
					long long l1=l[i].l,r1=l[i].r,l2=l[j].l,r2=l[j].r;
					if(l1+r2<=r1+l2)
					{
						ins(l1+l2,l1+r2,(l2-l1)*(-l2-l1+1),(l2-l1));
						ins(l1+r2+1,r1+l2,(r2+l2)*(r2-l2+1),(l2-r2-1));
						ins(r1+l2+1,r1+r2,(r1+r2+1)*(r2-r1),(r1-r2));
					}
					else
					{
						ins(l1+l2,r1+l2,(l2-l1)*(-l2-l1+1),(l2-l1));
						ins(r1+l2+1,l1+r2,(-l1-r1)*(r1-l1+1),(r1-l1+1));
						ins(l1+r2+1,r1+r2,(r1+r2+1)*(r2-r1),(r1-r2));
					}
				}
			}
		}
		for(int i=1;i<=lim*2;i++)
		{
			sm1[i]+=sm1[i-1];sm2[i]+=sm2[i-1];
			if(i%2==0) an1[i]+=sm1[i]+sm2[i]*i;
			else an1[i]-=sm1[i]+sm2[i]*i;
		}
		for(int i=1;i<=cn;i++)
		{
			for(int j=l[i].l*2+1;j<=l[i].r*2-1;j++)
			{
				long long L=max(j-l[i].r,l[i].l),R=(j-1)/2;
				if(j%2==1)
				{
					an1[j]+=-j*(R-L+1);
					an1[j]+=(L+R)*(R-L+1);
				}
				else
				{
					an1[j]+=j*(R-L+1);
					an1[j]+=-(L+R)*(R-L+1);
				}
			}
		}
		for(int i=1;i<=lim;i++) ann[i]+=an1[i*2-1]+an1[i*2];
		for(int i=lim-1;i>=0;i--) an[i]=an[i+1]+ann[i+1];
	}
	else
	{
		for(int i=0;i<=lim;i++) ann[i]=0;
		for(int i=0;i<=lim*2;i++) an1[i]=0;
		for(int i=cnn;i>=1;i-=2) ann[lim]+=d[i];
		for(int i=1;i<=cn;i++)
		{
			for(int j=l[i].l*2+1;j<=l[i].r*2-1;j++)
			{
				long long L=max(j-l[i].r,l[i].l),R=(j-1)/2;
				if(j%2==1) an1[j]+=(R-L+1)*(L+R)-(R-L+1)*j;
				else an1[j]-=(R-L+1)*(L+R)-(R-L+1)*j;
			}
		}
		for(int i=0;i<=lim*2;i++) sm1[i]=sm2[i]=0;
		for(int i=1;i<=cn;i++)
		{
			for(int j=i+1;j<=cn;j++)
			{
				int tt=1;
				long long l1=l[i].l,r1=l[i].r,l2=l[j].l,r2=l[j].r;
				if((sum[j-1]+sum[i]+l2+r1)%2==1) tt=-1;
				if(r2+l1<=r1+l2)
				{
					ins(l1+l2,l1+r2,(l1-l2)*(-l2-l1+1)*tt,(l1-l2)*tt);
					ins(l1+r2+1,r1+l2,(-l2-r2)*(r2-l2+1)*tt,(r2-l2+1)*tt);
					ins(r1+l2+1,r1+r2,(r1-r2)*(r1+r2+1)*tt,(r2-r1)*tt);
				}
				else
				{
					ins(l1+l2,r1+l2,(l1-l2)*(-l2-l1+1)*tt,(l1-l2)*tt);
					ins(r1+l2+1,l1+r2,(r1+l1)*(r1-l1+1)*tt,(l1-r1-1)*tt);
					ins(l1+r2+1,r1+r2,(r1-r2)*(r1+r2+1)*tt,(r2-r1)*tt);
				}
			}
		}
		for(int i=1;i<=lim*2;i++)
		{
			sm1[i]+=sm1[i-1];sm2[i]+=sm2[i-1];
			if(i%2==0) an1[i]+=sm1[i]+sm2[i]*i;
			else an1[i]-=sm1[i]+sm2[i]*i;
		}
		for(int i=lim-1;i>=0;i--) ann[i]=an1[i*2]+an1[i*2+1]+ann[i+1];
	}
	for(int i=1;i<=b;i++)
	{
		q=read();
		if(c==0) ans=ans^(ann[q]*i);
		else ans=ans^(an[q]*i);
	}
	printf("%llu",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 688ms
memory: 343900kb

input:

5000 2000 0
115 126
1542 1589
1770 1774
2876 2915
3533 3539
7176 7176
7734 7767
8709 8751
9090 9116
9203 9243
10529 10550
12013 12059
13857 13891
14952 14978
15892 15904
16431 16471
16992 17037
17217 17252
18012 18025
18835 18857
19069 19098
19304 19335
19368 19395
19742 19785
21043 21088
22572 2260...

output:

481592148304036

result:

ok single line: '481592148304036'

Test #2:

score: 15
Accepted
time: 1006ms
memory: 341820kb

input:

5000 2000 1
580 591
688 695
1195 1210
4475 4483
4532 4573
5034 5042
5606 5613
6364 6364
7715 7729
7950 7959
8131 8173
8359 8402
10225 10253
10614 10630
11218 11246
13108 13121
13154 13180
13727 13732
14041 14077
14662 14703
16525 16531
17259 17284
17721 17741
18672 18699
19585 19604
20708 20749
2119...

output:

332546405468778

result:

ok single line: '332546405468778'

Test #3:

score: 15
Accepted
time: 801ms
memory: 347912kb

input:

5000 2000 0
184 299
832 967
1438 1500
2138 2261
3051 3136
3373 3465
3539 3606
5574 5676
7224 7254
9508 9577
12216 12339
13918 13978
14098 14295
14845 14989
15889 15932
16005 16060
16200 16343
16680 16835
20205 20377
20506 20533
22380 22531
22706 22724
23493 23656
24052 24119
25003 25134
25468 25506
...

output:

703410250043655

result:

ok single line: '703410250043655'

Test #4:

score: 15
Accepted
time: 1017ms
memory: 343928kb

input:

5000 2000 1
3140 3269
3401 3483
4436 4609
7103 7288
8649 8791
12065 12158
17439 17632
17734 17856
18543 18704
19369 19401
19899 19910
20939 21005
21374 21374
21458 21561
22280 22412
31171 31279
32038 32140
34641 34770
35435 35546
36641 36750
37362 37555
37753 37866
39532 39626
39816 39894
41739 4186...

output:

1375543078253490

result:

ok single line: '1375543078253490'

Test #5:

score: 15
Accepted
time: 792ms
memory: 345892kb

input:

5000 2000 0
12 496
1662 2104
3792 4067
5073 5501
6422 6556
7679 7714
7915 8159
9256 9396
10698 11137
12769 13056
13446 13784
14646 14915
15120 15456
16714 17047
17095 17175
17204 17255
17864 18041
18881 19320
19872 20163
20201 20350
20550 20811
23648 23817
25445 25858
27933 27994
28193 28640
29687 2...

output:

235561024408628

result:

ok single line: '235561024408628'

Test #6:

score: 15
Accepted
time: 1194ms
memory: 347988kb

input:

5000 2000 1
197 556
981 1219
1426 1640
4324 4817
5337 5768
6407 6782
7851 8056
8363 8685
10627 10926
11237 11569
11872 12004
12456 12626
13757 14201
19292 19774
21994 22440
23321 23783
24316 24373
24570 24719
25169 25594
27942 28250
28479 28490
28938 29085
29812 30130
30215 30558
30636 30946
33045 3...

output:

1089420273336781

result:

ok single line: '1089420273336781'

Test #7:

score: 15
Accepted
time: 609ms
memory: 352008kb

input:

5000 2000 0
623 1044
2045 2235
2644 3145
3551 3601
3730 4185
4234 4327
4625 5094
5111 5473
5571 6472
6523 7172
7245 8052
8273 8811
9314 9822
11007 11967
12067 12601
13623 14409
14584 14978
15522 16154
16305 16814
16989 17255
17713 18415
18518 19281
19385 19994
20345 20946
22303 23057
23363 23571
236...

output:

1893300719301800

result:

ok single line: '1893300719301800'

Test #8:

score: 15
Accepted
time: 1003ms
memory: 354172kb

input:

5000 2000 1
319 1252
1394 2307
2758 3058
3503 3799
4898 5129
5207 5733
5919 6403
6504 6518
7182 7351
7790 8264
8290 8669
8803 9559
10002 10562
10671 11031
11084 11517
12253 12628
13079 13446
14300 15045
15288 16049
16230 17207
17341 17716
17848 18807
18963 19553
19613 19726
20276 20477
22810 23374
2...

output:

8890160765394668

result:

ok single line: '8890160765394668'

Subtask #2:

score: 25
Accepted

Test #9:

score: 25
Accepted
time: 895ms
memory: 343888kb

input:

5000 2000000 0
333 376
1484 1485
1602 1625
1751 1751
3230 3264
3473 3522
5932 5942
6782 6813
6830 6863
6982 7007
7013 7034
7226 7259
8555 8585
8652 8668
9354 9389
9440 9486
9942 9963
12552 12599
13153 13174
14096 14139
14895 14903
17478 17490
18195 18227
18907 18941
19183 19214
19635 19670
19984 200...

output:

386702830511273236

result:

ok single line: '386702830511273236'

Test #10:

score: 25
Accepted
time: 759ms
memory: 346000kb

input:

5000 2000000 0
724 778
1311 1342
1669 1749
2483 2582
2798 2892
4519 4534
5388 5418
5479 5490
5677 5744
7407 7496
7569 7648
9046 9125
9327 9385
11359 11398
11602 11669
11937 12035
14968 15041
15186 15271
16906 16935
17035 17060
18697 18719
19817 19839
20072 20077
20268 20332
20885 20923
22873 22935
2...

output:

40486127253744454

result:

ok single line: '40486127253744454'

Test #11:

score: 25
Accepted
time: 940ms
memory: 347976kb

input:

5000 2000000 0
2615 2712
2975 3063
3504 3550
3604 3616
4342 4426
4776 4952
5067 5215
6335 6436
7744 7885
9075 9123
9494 9576
11202 11376
11724 11852
12173 12235
14562 14606
15927 16071
17169 17208
17426 17474
17564 17656
21092 21123
21549 21727
22504 22564
23080 23109
23375 23572
26962 27150
27348 2...

output:

1988159332385109224

result:

ok single line: '1988159332385109224'

Test #12:

score: 25
Accepted
time: 1052ms
memory: 347976kb

input:

5000 2000000 0
2180 2355
2941 3018
3440 3466
4101 4195
5242 5302
5857 5937
6972 7111
7534 7749
10603 10787
13330 13593
14029 14150
15252 15391
16715 16876
18298 18301
18784 18898
19656 19807
19992 20237
20686 20767
21277 21310
22059 22187
22367 22522
22941 23070
23674 23702
23754 24024
24418 24674
2...

output:

2190514529545541745

result:

ok single line: '2190514529545541745'

Test #13:

score: 25
Accepted
time: 1012ms
memory: 350028kb

input:

5000 2000000 0
616 923
2028 2176
2371 3162
4989 5194
5786 5905
6939 7193
7584 8269
8831 9057
10244 10771
12278 12824
13600 14120
15544 16109
19486 19644
19972 20489
20829 20864
21014 21136
21292 21894
22050 22300
22350 22646
22975 23258
24618 24652
24828 25059
25401 25536
25833 26477
26502 26698
273...

output:

6292506210135890577

result:

ok single line: '6292506210135890577'

Test #14:

score: 25
Accepted
time: 1118ms
memory: 356168kb

input:

5000 2000000 0
5 473
1221 1344
1894 2461
2856 3465
3589 4463
4475 4975
6524 6727
7321 7895
8263 8585
8618 8777
9228 9558
10233 10451
10632 11133
11146 11176
11678 11819
11945 12288
13108 13887
14319 14520
15223 15807
17867 18039
18849 19285
20130 20972
21358 22074
22556 22815
22878 23745
23901 24017...

output:

1827539273516974645

result:

ok single line: '1827539273516974645'

Test #15:

score: 25
Accepted
time: 1209ms
memory: 354136kb

input:

5000 2000000 0
110 130
147 764
1339 2463
2673 3039
3824 4853
5452 6399
6611 7233
7354 8326
9202 9481
9593 10218
10603 11205
11408 11523
12497 13013
13549 14338
15102 16239
16268 16986
17302 18164
18177 19126
19483 20117
20341 20935
21071 21696
22543 23046
23068 24070
24211 25023
25036 25222
25511 26...

output:

149145100173757691

result:

ok single line: '149145100173757691'

Test #16:

score: 25
Accepted
time: 849ms
memory: 358240kb

input:

5000 2000000 0
644 899
1481 2342
3314 4245
4979 5091
5423 6711
6808 6916
7103 7565
7724 8729
8823 9757
9984 10147
10499 11085
11429 11744
12065 12832
13200 13861
14066 15037
15053 15220
15630 15706
15767 15775
15888 16328
16388 16436
16505 17238
17330 17821
18213 19337
19446 20792
21255 22625
23243 ...

output:

5690695844012616215

result:

ok single line: '5690695844012616215'

Subtask #3:

score: 20
Accepted

Test #17:

score: 20
Accepted
time: 394ms
memory: 340132kb

input:

5000 2000000 1
53 53
54 54
1775 1775
1776 1776
2217 2217
2312 2312
4982 4982
5212 5212
5213 5213
5214 5214
6199 6199
8528 8528
10141 10141
10142 10142
10719 10719
10720 10720
10721 10721
11868 11868
12311 12311
12312 12312
12313 12313
16789 16789
18899 18899
18900 18900
22515 22515
22516 22516
25061...

output:

9396621550536124

result:

ok single line: '9396621550536124'

Test #18:

score: 20
Accepted
time: 263ms
memory: 344228kb

input:

5000 2000000 1
607 607
608 608
1117 1117
1118 1118
1119 1119
1120 1120
2963 2963
2964 2964
2965 2965
3269 3269
3270 3270
3271 3271
3272 3272
3690 3690
5126 5126
5127 5127
5128 5128
5357 5357
5358 5358
5359 5359
5676 5676
5677 5677
5678 5678
5679 5679
5799 5799
7141 7141
7142 7142
7143 7143
7144 7144...

output:

3924758937980887

result:

ok single line: '3924758937980887'

Test #19:

score: 20
Accepted
time: 279ms
memory: 340796kb

input:

5000 2000000 1
1146 1146
1147 1147
1148 1148
1149 1149
1150 1150
1151 1151
1152 1152
1153 1153
1154 1154
1155 1155
1156 1156
1368 1368
1369 1369
1370 1370
1371 1371
1372 1372
1373 1373
1374 1374
1375 1375
1376 1376
1377 1377
3023 3023
3024 3024
3025 3025
3026 3026
7294 7294
7295 7295
7296 7296
7297 ...

output:

3498950038337569

result:

ok single line: '3498950038337569'

Test #20:

score: 20
Accepted
time: 252ms
memory: 344356kb

input:

5000 2000000 1
207 207
208 208
209 209
210 210
211 211
212 212
213 213
214 214
215 215
216 216
217 217
218 218
219 219
220 220
221 221
1497 1497
1498 1498
1499 1499
2546 2546
2547 2547
2548 2548
2549 2549
2550 2550
2551 2551
2552 2552
2553 2553
2554 2554
2555 2555
2556 2556
2557 2557
2558 2558
3491 ...

output:

3361440413095543

result:

ok single line: '3361440413095543'

Test #21:

score: 20
Accepted
time: 208ms
memory: 342876kb

input:

5000 2000000 1
6166 6166
6167 6167
6168 6168
6169 6169
6170 6170
6171 6171
6172 6172
6189 6189
6505 6505
6506 6506
6507 6507
6508 6508
13543 13543
13544 13544
13545 13545
13546 13546
13547 13547
13548 13548
13549 13549
13550 13550
16246 16246
16247 16247
16248 16248
16249 16249
18920 18920
18921 189...

output:

6515086919470194

result:

ok single line: '6515086919470194'

Test #22:

score: 20
Accepted
time: 271ms
memory: 344568kb

input:

5000 2000000 1
50157 50157
50158 50158
50159 50159
50160 50160
50161 50161
50162 50162
50163 50163
50164 50164
50165 50165
50166 50166
50167 50167
50168 50168
50169 50169
50170 50170
50171 50171
50172 50172
50173 50173
50174 50174
50175 50175
50176 50176
50177 50177
50178 50178
50179 50179
50180 501...

output:

16846380168054

result:

ok single line: '16846380168054'

Test #23:

score: 20
Accepted
time: 187ms
memory: 344784kb

input:

5000 2000000 1
1571 1571
1572 1572
1573 1573
1574 1574
1575 1575
1576 1576
1577 1577
1578 1578
1579 1579
1580 1580
1581 1581
1582 1582
1583 1583
1584 1584
1585 1585
1586 1586
1587 1587
1588 1588
1589 1589
1590 1590
1591 1591
1592 1592
1593 1593
1594 1594
1595 1595
1596 1596
1597 1597
1598 1598
1599 ...

output:

758710189026162

result:

ok single line: '758710189026162'

Test #24:

score: 20
Accepted
time: 235ms
memory: 339576kb

input:

5000 2000000 1
3287 3287
3288 3288
3289 3289
3290 3290
3291 3291
3292 3292
3293 3293
3294 3294
3295 3295
3296 3296
3297 3297
3298 3298
3299 3299
3300 3300
3301 3301
3302 3302
3303 3303
3304 3304
3305 3305
3306 3306
3307 3307
3308 3308
3309 3309
3310 3310
3311 3311
3312 3312
3313 3313
3314 3314
3315 ...

output:

1870212953908404

result:

ok single line: '1870212953908404'

Subtask #4:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #25:

score: 40
Accepted
time: 1204ms
memory: 352024kb

input:

5000 2000000 1
271 514
961 1578
1881 1888
2510 3283
4056 4512
4664 4853
5003 5554
6205 6474
7333 8206
8401 8525
9225 9956
10740 11079
11324 12295
13671 14066
14162 14995
15141 15695
15774 16632
16750 16866
16998 17233
17377 17384
17443 17928
17952 18330
18831 19424
20781 21567
21695 21768
23369 2401...

output:

9098533078850716928

result:

ok single line: '9098533078850716928'

Test #26:

score: 40
Accepted
time: 1129ms
memory: 354188kb

input:

5000 2000000 1
1431 2292
2496 3423
3677 4286
4902 5688
7675 8458
8879 9329
9429 10291
10364 11189
13167 14105
14468 15436
16682 16863
17275 17480
18070 18902
18977 19939
20078 20538
20858 21357
21835 22313
22567 22917
23257 23528
23852 24430
24991 25937
26342 26856
28132 28974
29118 29943
30199 3050...

output:

1217041477980805705

result:

ok single line: '1217041477980805705'

Test #27:

score: 40
Accepted
time: 1315ms
memory: 349968kb

input:

5000 2000000 1
94 787
2052 2386
3106 3593
4641 5060
5555 6314
6783 7117
7614 7909
8991 9678
10252 10952
11363 12048
12073 12591
12643 12653
12862 12886
13547 13718
13861 14377
14587 14880
15150 15656
15860 15888
16614 17324
18362 18374
20465 21032
22421 22986
23290 23662
24702 24972
25889 26130
2952...

output:

187471103699933008

result:

ok single line: '187471103699933008'

Test #28:

score: 40
Accepted
time: 1224ms
memory: 347932kb

input:

5000 2000000 1
412 438
818 1287
2513 2985
4088 4485
5532 5535
7559 7992
8553 8880
9074 9543
10574 10948
12295 12510
12998 13293
13766 14195
16078 16266
17348 17814
18063 18185
18420 18430
18535 18822
19649 20148
21320 21725
21906 22202
22438 22496
23514 23823
24786 24947
25069 25556
26079 26525
2696...

output:

2319420637533670020

result:

ok single line: '2319420637533670020'

Test #29:

score: 40
Accepted
time: 1330ms
memory: 346080kb

input:

5000 2000000 1
92 283
2252 2523
2580 2784
3964 4012
4075 4287
4793 4850
8049 8112
8454 8558
10137 10215
10223 10491
12753 12977
13649 13881
14183 14367
15310 15404
16835 17075
17951 17990
19699 19878
20355 20407
21373 21439
22086 22269
22699 22722
22768 22864
22970 23156
25644 25828
26671 26716
2928...

output:

526082419854324962

result:

ok single line: '526082419854324962'

Test #30:

score: 40
Accepted
time: 1364ms
memory: 347964kb

input:

5000 2000000 1
549 648
719 806
1128 1269
1463 1464
2300 2448
2825 2844
3161 3265
5182 5309
6241 6321
7332 7385
7978 8086
10858 10996
11556 11727
11742 11837
12841 12875
14084 14129
14445 14568
14614 14718
15138 15210
18342 18342
18411 18423
19133 19205
19652 19662
20222 20230
22495 22538
23795 23864...

output:

1726768471070328416

result:

ok single line: '1726768471070328416'

Test #31:

score: 40
Accepted
time: 922ms
memory: 342340kb

input:

5000 2000000 1
3923 3971
4761 4805
5123 5205
7574 7575
9541 9561
10118 10178
10927 11017
11428 11526
11923 11951
12003 12011
12679 12747
13837 13927
17602 17626
18987 19038
20636 20685
21118 21135
22542 22607
24691 24711
25513 25517
26250 26314
26635 26650
27685 27715
29468 29543
29563 29608
32725 3...

output:

968049625689107613

result:

ok single line: '968049625689107613'

Test #32:

score: 40
Accepted
time: 1123ms
memory: 343868kb

input:

5000 2000000 1
322 327
430 435
740 766
1246 1254
1441 1471
2224 2224
2440 2486
3381 3425
3977 3988
5121 5156
5160 5182
6856 6885
7071 7084
7120 7155
7471 7485
8635 8641
10736 10762
13308 13354
13794 13812
13814 13815
14953 14968
16102 16130
18707 18756
18903 18936
20382 20400
20846 20855
21669 21706...

output:

363777857332547512

result:

ok single line: '363777857332547512'

Extra Test:

score: 0
Extra Test Passed