QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#235087#6776. Gardensjc061031100 ✓1343ms361852kbC++143.8kb2023-11-02 13:40:392023-11-02 13:40:39

Judging History

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

  • [2023-11-02 13:40:39]
  • 评测
  • 测评结果:100
  • 用时:1343ms
  • 内存:361852kb
  • [2023-11-02 13:40:39]
  • 提交

answer

#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
//#define int long long
using namespace __gnu_pbds;
using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int n,m,d,visr[5010],visc[5010],f[5010][5010],g[5010][5010],h[5010],cnt[5010],a[5010],b[5010],c[5010],L[5010],R[5010];
vector<int> v[5010],vec[5010];

signed main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>n>>m>>d;
	for(int i=1;i<=n;i++){
		int x,y;cin>>x>>y;
		visr[x]=1;visc[y]=1;
	}
	for(int i=1;i<=m;i++){
		int x,y;cin>>x>>y;
		v[x].push_back(y);
	}
	for(int i=0;i<=d-1;i++){
		if(i>0){
			for(int j=0;j<=d-1;j++) f[i][j]=f[i-1][j];
		}
		else{
			for(int j=0;j<=d-1;j++) f[i][j]=-1;
		}
		for(int j=0;j<(int)v[i].size();j++){
			f[i][v[i][j]]=i;
		}
	}
	for(int i=d-1;i>=0;i--){
		if(i<d-1){
			for(int j=0;j<=d-1;j++) g[i][j]=g[i+1][j];
		}
		else{
			for(int j=0;j<=d-1;j++) g[i][j]=-1;
		}
		for(int j=0;j<(int)v[i].size();j++){
			if(g[i][v[i][j]]==-1) g[i][v[i][j]]=i;
		}
	}
	int ans=d*d; 
	for(int i=0;i<=d-1;i++){
		for(int j=0;j<=d-1;j++) vec[j].clear();
		for(int j=0;j<=d-1;j++){
			if(visc[j]){
				h[j]=0;
				if(i>0) vec[i-1].push_back(j);
				else vec[d-1].push_back(j);
			}
			else{
				if(i>0&&f[i-1][j]!=-1){
					h[j]=i-f[i-1][j];
					if(f[i-1][j]==0) vec[d-1].push_back(j);
					else vec[f[i-1][j]-1].push_back(j);
				}
				else if(g[i][j]!=-1){
					h[j]=i+d-g[i][j];
					if(g[i][j]>i) vec[g[i][j]-1].push_back(j);
				}
				else h[j]=d+1;
			}
		}
		for(int j=0;j<=d;j++) cnt[j]=0;
		vector<pair<int,int> > o;
		for(int j=0;j<=d-1;j++){
			while(!o.empty()){
				if(o.back().first>h[j]) o.pop_back();
				else break;
			}
			o.push_back(make_pair(h[j],j-d));
		}
		for(int j=0;j<=d-1;j++){
			while(!o.empty()){
				if(o.back().first>h[j]||(o.back().first==h[j]&&o.back().second<0&&o.back().second+d>=j)) o.pop_back();
				else break;
			}
			if(o.empty()) L[j]=-d-1;
			else L[j]=o.back().second;
			o.push_back(make_pair(h[j],j));
		}
		o.clear();
		for(int j=d-1;j>=0;j--){
			while(!o.empty()){
				if(o.back().first>=h[j]) o.pop_back();
				else break; 
			}
			o.push_back(make_pair(h[j],j+d));
		}
		for(int j=d-1;j>=0;j--){
			while(!o.empty()){
				if(o.back().first>h[j]||(o.back().first==h[j]&&(o.back().second<d||o.back().second-d>=j))) o.pop_back();
				else break; 
			}
			if(o.empty()) R[j]=d+d;
			else R[j]=o.back().second;
			o.push_back(make_pair(h[j],j));
		}
		for(int j=0;j<=d-1;j++){
			if(L[j]==-d-1&&R[j]==d+d){
				a[j]=d;b[j]=d-1;c[j]=0;
			}
			else{
				a[j]=R[j]-L[j]-1;b[j]=j-L[j]-1;c[j]=R[j]-j-1;
			}
		}
		bool flag=true;
		cnt[d]++;
		int maxv=d,now=d;
		for(int j=i-1;j>=0;j--){
			for(int k=0;k<(int)vec[j].size();k++){
				int u=vec[j][k];cnt[a[u]]--;cnt[b[u]]++;cnt[c[u]]++;
			}
			while(cnt[maxv]==0) maxv--;
			ans=min(ans,now*(d-maxv));
			if(visr[j]){
				flag=false;break;
			}
			now--;
		}
		if(!flag) continue;
		for(int j=d-1;j>=i;j--){
			for(int k=0;k<(int)vec[j].size();k++){
				int u=vec[j][k];cnt[a[u]]--;cnt[b[u]]++;cnt[c[u]]++;
			}
			while(cnt[maxv]==0) maxv--;
			ans=min(ans,now*(d-maxv)); 
			if(visr[j]){
				flag=false;break;
			}
			now--;
		}
	}
	cout<<ans<<'\n';
	return 0;
}

详细

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 106ms
memory: 99364kb

input:

499986 5 1979
299 1572
1897 274
119 291
206 1287
816 937
1922 1376
1676 57
1106 1706
1534 176
678 606
722 473
399 727
1682 1736
221 506
1413 1857
523 1730
1699 346
1056 1287
801 1017
314 1938
1872 189
1750 581
1846 1937
37 1840
1760 725
1465 1222
678 1203
1422 1930
1273 195
730 1930
232 1666
860 352...

output:

3900625

result:

ok single line: '3900625'

Test #2:

score: 0
Accepted
time: 40ms
memory: 35104kb

input:

499995 5 730
281 471
721 96
170 272
253 96
558 272
422 619
565 471
591 518
283 471
393 471
38 96
324 471
537 96
589 518
92 518
247 272
557 471
610 518
166 96
472 619
674 619
665 518
647 619
286 471
563 96
328 619
586 619
728 272
537 619
37 518
333 518
339 471
666 272
144 96
693 96
690 518
432 518
61...

output:

379900

result:

ok single line: '379900'

Test #3:

score: 0
Accepted
time: 410ms
memory: 200112kb

input:

499991 8 5000
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4082
4150 4...

output:

3527

result:

ok single line: '3527'

Test #4:

score: 0
Accepted
time: 402ms
memory: 200124kb

input:

499987 8 5000
1018 2994
1018 1427
1018 1427
3153 1767
3153 1767
628 2994
1018 2994
628 2994
3153 1767
1018 1427
628 1427
3153 1427
1018 1427
628 2994
3153 1427
3153 1427
628 1767
628 1427
3153 1427
628 1427
628 1767
3153 1427
3153 1427
1018 1767
628 1767
628 1427
628 1427
3153 1767
3153 1767
3153 14...

output:

5571104

result:

ok single line: '5571104'

Test #5:

score: 0
Accepted
time: 415ms
memory: 200188kb

input:

499989 8 5000
3239 2114
3239 2114
4705 2114
4705 3179
4705 2844
4316 2844
60 1374
4705 3179
587 4174
587 2844
60 3179
587 4174
60 3179
4316 2114
587 2844
4316 4174
3239 3179
587 2844
4316 1374
60 2844
587 3179
3239 2114
4705 2114
4705 3179
587 2114
4705 1374
4705 4174
60 1374
587 2114
587 3179
587 3...

output:

7058520

result:

ok single line: '7058520'

Test #6:

score: 0
Accepted
time: 422ms
memory: 202788kb

input:

499989 8 5000
1418 3865
2676 113
2098 3865
277 2517
2674 1513
4473 3203
3375 3671
2355 4359
4473 2124
4020 3372
277 420
3373 2386
1665 3839
928 2557
783 2386
4962 3401
1965 3325
2278 2124
4820 2277
1665 227
341 4359
4131 4359
1362 4774
3387 94
2489 4313
2998 3447
4576 901
2676 1211
2674 3346
1665 21...

output:

21917250

result:

ok single line: '21917250'

Test #7:

score: 0
Accepted
time: 417ms
memory: 202780kb

input:

499988 8 5000
706 4465
3063 2986
569 343
569 3140
2101 1600
32 1544
2051 2518
3094 325
706 272
4372 4717
1333 1072
667 347
4372 3274
404 2518
2008 4825
4521 2667
3500 4920
3596 1398
3596 2962
404 59
3867 206
3867 2436
3581 2591
2241 1072
3005 4083
2692 1995
2301 3954
827 1570
3516 2337
3516 4083
123...

output:

21918420

result:

ok single line: '21918420'

Test #8:

score: 0
Accepted
time: 474ms
memory: 360028kb

input:

499988 8 5000
2062 4632
2414 4549
2813 1172
2465 3485
3056 1310
4361 2346
4376 3333
1218 4524
2698 2849
3717 2022
3699 1565
1215 3660
4926 4859
1680 3419
4587 1224
723 3352
2518 4253
1190 558
4765 649
561 1614
432 3787
3317 3046
1487 3220
3980 2703
2421 3714
2913 111
4874 4205
3219 4087
2398 3596
37...

output:

24990001

result:

ok single line: '24990001'

Test #9:

score: 0
Accepted
time: 483ms
memory: 359796kb

input:

499987 8 5000
4709 2965
1888 4565
3998 344
2313 4909
2445 1979
3153 3191
3604 255
4958 1434
4016 1979
1648 2839
4697 4806
2477 2419
113 755
2123 2401
4045 465
3569 3449
2371 4028
4139 2516
4419 12
1662 1981
2387 3724
2184 4310
3735 1424
3221 3957
1085 193
2753 4339
2356 4988
3872 25
2641 179
822 462...

output:

25000000

result:

ok single line: '25000000'

Test #10:

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

input:

499988 3 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0...

output:

1

result:

ok single line: '1'

Subtask #2:

score: 6
Accepted

Test #11:

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

input:

4835 162 4
0 3
0 2
2 0
0 0
2 3
2 3
2 1
2 0
2 2
2 0
0 1
2 2
2 0
0 0
2 2
0 1
0 1
2 1
0 1
0 2
0 0
2 3
2 2
0 0
2 0
0 3
0 3
2 0
0 1
2 1
2 1
2 2
2 2
0 0
2 2
2 0
0 2
0 0
2 2
0 1
2 2
2 1
0 3
0 0
0 1
0 3
0 3
0 3
0 2
2 1
2 2
0 2
0 2
2 3
2 2
2 1
2 3
0 3
2 0
2 2
2 0
2 2
0 0
0 0
2 3
2 0
0 2
0 1
0 0
2 2
0 1
2 1
2...

output:

12

result:

ok single line: '12'

Test #12:

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

input:

1759 3239 7
5 5
2 5
3 5
3 5
2 5
1 5
3 5
4 5
5 5
1 5
3 5
5 5
2 5
5 5
5 5
2 5
4 5
1 5
1 5
4 5
2 5
3 5
1 5
4 5
5 5
1 5
2 5
1 5
1 5
3 5
4 5
2 5
1 5
2 5
5 5
2 5
2 5
4 5
3 5
2 5
4 5
5 5
5 5
2 5
3 5
4 5
1 5
2 5
4 5
3 5
3 5
3 5
4 5
5 5
3 5
3 5
1 5
5 5
1 5
3 5
1 5
5 5
4 5
3 5
5 5
3 5
4 5
2 5
5 5
2 5
2 5
2 5
...

output:

5

result:

ok single line: '5'

Test #13:

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

input:

8 4992 10
8 3
8 3
8 3
8 3
8 3
8 3
8 3
8 3
9 0
2 9
6 2
4 5
2 5
6 9
0 0
3 4
7 6
6 8
9 1
5 6
4 7
3 8
1 9
7 8
6 7
6 4
9 5
9 5
7 2
6 4
9 5
5 2
5 0
2 9
9 1
1 8
9 7
9 8
3 4
1 2
3 5
1 1
6 8
4 5
4 2
2 9
2 9
1 0
4 8
2 9
7 2
4 5
5 7
5 8
3 6
2 1
0 6
2 8
9 5
1 6
4 2
4 7
2 1
1 9
2 5
3 8
1 4
9 6
9 2
9 8
5 1
9 7
5 ...

output:

10

result:

ok single line: '10'

Test #14:

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

input:

9 4988 10
8 1
8 1
8 1
8 1
8 1
8 1
8 1
8 1
8 1
9 4
4 9
4 0
6 7
4 2
3 9
7 5
0 9
3 9
3 8
1 9
7 9
6 4
7 5
9 4
5 4
5 7
5 4
2 6
1 6
3 8
4 0
9 4
0 7
6 5
5 4
9 8
0 3
9 7
3 6
7 9
2 5
2 8
4 6
0 3
7 9
4 2
1 0
4 0
1 8
0 7
5 8
6 9
7 5
5 7
5 0
3 3
1 8
9 7
2 3
0 3
1 7
6 7
4 2
5 0
1 7
9 3
3 3
4 9
7 9
0 7
7 5
7 8
7 ...

output:

10

result:

ok single line: '10'

Test #15:

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

input:

7 4991 10
2 4
2 4
2 4
2 4
2 4
2 4
2 4
5 0
4 7
8 9
0 1
5 0
9 5
8 9
1 2
4 7
1 2
6 8
6 8
7 7
7 7
3 5
8 9
7 7
9 5
4 7
0 1
0 1
5 0
5 0
4 7
4 7
5 0
0 1
1 2
7 7
5 0
3 5
3 5
8 9
8 9
9 5
7 7
5 0
0 1
5 0
8 9
9 5
8 9
9 5
8 9
9 5
5 0
6 8
4 7
6 8
3 5
0 1
0 1
6 8
5 0
4 7
3 5
3 5
5 0
3 5
1 2
5 0
7 7
8 9
7 7
1 2
6 ...

output:

9

result:

ok single line: '9'

Test #16:

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

input:

13 4984 10
7 0
4 5
4 0
4 0
6 5
6 5
6 8
7 5
4 0
7 8
4 5
7 8
6 5
1 1
1 1
9 7
0 7
5 9
8 6
8 4
1 1
5 4
0 4
1 6
2 7
2 2
8 1
1 7
0 4
3 7
0 9
5 6
9 7
2 9
5 1
3 1
0 6
2 1
5 1
2 3
2 1
5 1
1 9
9 2
9 9
3 9
8 4
3 3
0 7
2 6
5 7
9 2
2 6
0 9
2 2
2 1
2 7
9 4
0 3
2 2
2 3
2 4
9 6
5 3
9 3
5 7
8 2
5 7
9 3
2 1
3 2
0 7
3...

output:

40

result:

ok single line: '40'

Test #17:

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

input:

5 4990 10
0 4
7 7
2 8
3 9
6 3
1 2
4 5
5 5
9 2
5 5
8 0
8 2
5 5
9 2
4 6
5 2
5 0
8 1
9 5
4 2
8 1
1 2
9 2
5 6
4 2
4 6
1 0
8 2
9 2
1 6
5 1
5 5
4 1
1 1
4 0
5 5
1 6
1 1
8 6
1 2
4 0
8 1
8 2
9 2
8 5
9 1
1 0
4 2
1 5
1 0
5 1
5 1
9 0
1 1
5 1
9 6
1 5
9 2
4 0
5 6
1 6
4 0
4 0
4 2
4 2
8 1
9 0
9 5
8 1
9 5
1 0
1 2
4 ...

output:

70

result:

ok single line: '70'

Test #18:

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

input:

13 4987 10
5 8
0 5
6 8
2 0
2 4
7 7
6 7
0 4
7 7
7 0
6 0
0 5
0 8
8 6
4 1
3 3
8 6
4 1
1 3
8 6
9 9
1 3
4 1
9 9
4 1
8 6
9 9
8 6
1 3
8 6
4 1
3 3
4 1
9 9
9 9
8 6
8 6
4 1
1 3
8 6
3 3
9 9
1 3
3 3
8 6
1 3
1 3
8 6
1 3
4 1
3 3
8 6
3 3
1 3
4 1
3 3
8 6
9 9
1 3
9 9
8 6
8 6
9 9
4 1
8 6
8 6
4 1
4 1
9 9
8 6
3 3
3 3
8...

output:

56

result:

ok single line: '56'

Test #19:

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

input:

16 4983 10
4 8
1 3
7 6
9 1
5 7
7 2
5 2
8 0
2 4
3 8
4 8
4 4
9 9
7 8
6 7
0 5
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9 6
9...

output:

100

result:

ok single line: '100'

Test #20:

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

input:

4977 20 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 ...

output:

1

result:

ok single line: '1'

Test #21:

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

input:

3 4997 2
0 1
0 1
0 1
0 0
1 1
0 1
1 1
1 1
0 0
0 1
0 1
0 0
0 1
0 1
1 0
1 1
0 1
0 1
1 1
1 1
1 1
0 1
0 1
1 1
0 0
1 1
1 0
0 0
1 1
0 1
1 0
0 0
1 0
1 0
0 1
0 0
0 0
1 0
1 1
1 0
1 0
1 0
1 1
1 1
0 1
0 0
0 0
0 0
0 0
0 1
0 0
1 0
0 1
1 1
1 1
1 0
1 1
0 0
0 0
1 1
1 1
1 1
0 0
0 1
0 1
1 1
0 1
1 0
1 0
0 1
0 0
0 1
1 1...

output:

2

result:

ok single line: '2'

Subtask #3:

score: 8
Accepted

Dependency #2:

100%
Accepted

Test #22:

score: 8
Accepted
time: 1ms
memory: 6136kb

input:

2098 2896 47
18 20
23 28
6 4
5 4
29 4
21 20
24 17
7 20
21 37
7 37
44 44
23 44
18 37
7 4
4 4
5 26
29 37
16 28
14 20
38 44
29 44
24 17
24 37
21 11
29 11
5 20
5 44
23 26
2 32
7 4
14 4
6 33
7 20
2 44
3 17
16 17
20 4
14 17
16 4
44 17
3 44
16 33
7 11
4 32
18 44
3 44
21 33
23 17
2 26
18 20
4 23
16 44
16 11...

output:

1599

result:

ok single line: '1599'

Test #23:

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

input:

2355 2645 37
24 17
10 35
10 8
24 19
1 0
1 29
20 33
3 36
3 24
1 12
24 14
20 23
10 30
10 35
10 20
3 29
10 20
10 8
24 33
10 0
10 21
24 2
20 25
24 17
1 21
10 26
20 19
1 35
10 17
3 5
24 21
3 23
10 3
24 3
3 26
20 36
24 2
1 14
1 26
3 18
10 5
10 36
20 25
20 31
3 24
3 9
24 21
24 36
10 8
24 2
10 36
10 16
1 9
...

output:

840

result:

ok single line: '840'

Test #24:

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

input:

3 4995 50
37 16
37 16
37 16
19 40
9 15
26 18
28 23
39 19
28 5
20 46
8 46
20 23
8 37
3 14
42 14
43 5
10 35
44 29
28 14
19 49
10 31
11 47
36 14
15 40
44 3
34 32
24 9
20 6
34 26
19 44
49 25
6 22
31 12
24 12
6 8
2 46
20 8
23 42
10 42
28 43
8 44
4 0
33 25
9 42
40 21
48 10
2 4
39 49
33 45
40 35
41 10
49 1...

output:

50

result:

ok single line: '50'

Test #25:

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

input:

11 4985 50
21 35
21 35
21 35
21 35
21 35
21 35
21 35
21 35
21 35
21 35
21 35
2 32
24 16
0 28
20 13
48 3
36 36
39 10
4 10
3 29
34 39
19 11
14 22
13 18
19 24
42 34
49 31
15 7
39 19
27 11
28 8
26 47
10 20
23 0
19 28
2 32
3 24
12 25
36 0
26 4
37 28
28 11
6 16
16 43
0 5
37 28
29 5
35 17
11 20
44 49
19 11...

output:

50

result:

ok single line: '50'

Test #26:

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

input:

8 4990 50
6 27
6 27
6 27
6 27
6 27
6 27
6 27
6 27
11 41
38 18
0 46
8 25
49 49
1 11
4 3
35 0
3 36
11 41
24 14
42 31
31 46
7 14
27 2
13 5
8 25
36 23
43 47
39 39
27 2
26 36
11 41
35 0
49 49
40 0
28 9
17 26
49 49
16 9
29 42
10 43
17 26
10 43
29 42
32 28
47 3
16 9
40 0
37 29
15 32
31 46
10 43
19 49
48 31...

output:

47

result:

ok single line: '47'

Test #27:

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

input:

14 4986 50
8 14
11 3
23 40
16 14
8 40
23 3
11 36
16 44
16 36
11 36
23 44
12 40
12 14
11 40
42 6
19 37
29 6
28 46
2 0
40 9
44 20
21 6
14 37
10 49
2 34
22 49
2 22
14 30
46 47
21 30
2 0
36 12
3 45
1 2
43 19
32 30
26 13
17 22
25 47
36 37
38 16
41 17
34 45
15 2
13 35
21 17
38 20
29 47
45 45
22 31
44 21
3...

output:

800

result:

ok single line: '800'

Test #28:

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

input:

10 4985 50
40 47
6 32
6 11
6 37
2 47
2 16
8 37
29 32
6 37
40 37
35 19
12 49
24 1
19 19
9 14
33 0
33 20
17 2
1 44
46 24
10 22
21 7
21 39
23 30
48 41
35 19
34 21
49 13
9 4
32 4
36 4
19 4
34 21
41 31
25 44
13 36
42 49
33 0
48 23
36 4
44 46
17 2
11 19
21 38
21 39
43 31
48 13
46 26
43 5
28 27
33 20
44 14...

output:

1470

result:

ok single line: '1470'

Test #29:

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

input:

8 4989 50
46 35
27 30
13 11
6 47
38 11
6 47
46 29
27 30
3 2
33 15
35 16
2 19
39 14
9 28
19 17
15 6
30 36
8 12
4 41
17 40
11 23
49 6
24 40
24 40
24 40
22 22
32 46
1 19
8 12
45 15
36 14
24 40
4 41
28 27
25 28
8 12
0 7
1 19
25 28
21 46
5 19
48 41
24 40
17 40
15 6
8 12
2 19
47 44
33 15
37 5
9 28
39 14
4...

output:

1443

result:

ok single line: '1443'

Test #30:

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

input:

50 4949 50
48 25
9 45
17 20
6 29
28 44
31 22
30 44
0 44
12 19
38 1
18 24
8 8
4 43
49 0
40 14
21 36
21 35
17 39
20 5
5 9
46 26
13 2
12 47
15 29
45 34
45 27
41 19
3 22
35 6
11 41
44 24
34 48
42 42
29 36
37 13
34 7
19 31
7 44
14 26
21 28
33 40
38 39
28 23
16 38
25 32
36 16
7 33
43 37
47 11
44 49
1 21
2...

output:

2350

result:

ok single line: '2350'

Test #31:

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

input:

52 4947 50
39 15
49 31
34 45
43 42
40 25
13 23
28 37
23 38
19 32
25 19
30 6
11 36
15 28
47 48
38 22
21 39
8 34
14 46
10 33
12 36
42 43
31 41
3 8
35 26
9 36
32 21
16 20
41 30
17 49
28 29
44 47
45 11
36 24
20 10
33 5
18 7
0 3
24 12
16 40
46 4
37 13
4 18
29 35
27 2
26 27
7 17
5 1
48 14
22 44
2 9
6 0
1 ...

output:

2500

result:

ok single line: '2500'

Subtask #4:

score: 16
Accepted

Dependency #3:

100%
Accepted

Test #32:

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

input:

3086 1910 47
7 32
34 32
7 28
8 32
9 17
7 28
43 10
7 32
33 13
24 15
39 10
8 15
30 19
45 15
46 15
44 13
4 28
12 10
41 19
15 13
14 17
16 15
12 17
8 13
30 17
25 10
0 19
4 0
46 13
29 28
4 33
11 17
1 19
27 17
18 0
26 17
18 0
33 0
13 15
36 32
8 17
34 13
33 10
13 10
43 17
46 19
26 32
41 15
16 33
14 17
41 10...

output:

1496

result:

ok single line: '1496'

Test #33:

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

input:

4282 718 76
11 11
44 3
64 39
25 35
39 30
40 32
74 42
12 42
64 27
42 43
3 30
23 32
43 53
7 30
53 64
45 30
7 66
45 65
64 13
42 54
59 53
23 53
72 23
16 27
29 66
64 54
64 9
30 2
25 74
39 53
42 43
59 45
36 30
5 11
59 11
59 66
41 52
15 30
29 45
12 64
34 61
65 39
45 39
57 39
34 3
23 43
63 54
64 4
42 27
64 ...

output:

4968

result:

ok single line: '4968'

Test #34:

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

input:

3 4995 100
48 29
48 29
48 29
83 85
2 85
78 78
16 15
58 91
76 27
63 57
53 81
80 32
96 25
12 80
9 27
41 57
5 6
4 41
32 49
69 24
61 8
76 96
33 37
65 96
93 85
49 43
76 21
81 86
95 59
43 6
56 12
30 58
50 51
72 24
83 84
65 86
62 1
61 21
15 38
26 44
3 25
16 61
49 33
57 55
26 5
99 44
14 23
72 71
43 30
26 48...

output:

100

result:

ok single line: '100'

Test #35:

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

input:

10 4988 100
97 33
97 33
97 33
97 33
97 33
97 33
97 33
97 33
97 33
97 33
51 3
71 12
80 23
15 10
3 82
56 7
39 15
46 40
24 31
88 99
19 45
70 61
52 5
42 56
37 27
48 48
72 68
15 21
2 73
94 39
78 63
73 86
46 53
15 21
59 15
17 91
34 4
78 63
0 63
73 86
44 22
13 60
26 35
98 70
8 13
44 84
90 78
95 48
64 84
54...

output:

100

result:

ok single line: '100'

Test #36:

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

input:

1 4997 100
73 83
95 96
30 82
37 80
5 46
27 93
2 52
11 25
64 85
53 15
7 16
17 47
93 14
36 88
92 68
35 34
3 33
63 53
96 79
59 77
36 88
17 47
59 77
62 48
8 31
17 47
86 15
38 74
14 54
79 92
77 38
62 48
40 50
8 31
6 44
53 15
33 99
21 87
95 96
26 66
63 53
51 78
56 59
97 62
14 54
51 78
63 53
8 31
41 92
18 ...

output:

95

result:

ok single line: '95'

Test #37:

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

input:

13 4982 100
32 30
71 29
71 35
32 72
33 30
33 72
24 24
71 35
71 72
33 35
32 24
3 29
24 24
76 20
29 99
70 12
0 28
78 20
56 6
18 96
7 57
41 13
30 77
51 3
60 87
27 33
15 98
9 73
78 94
58 58
91 88
47 65
2 69
83 33
2 57
7 80
66 95
83 34
78 58
56 21
17 61
56 58
10 52
2 98
0 68
38 47
36 31
63 25
21 46
93 59...

output:

4900

result:

ok single line: '4900'

Test #38:

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

input:

10 4990 100
23 17
99 62
99 43
25 69
59 69
99 17
69 43
99 81
59 81
25 43
73 0
79 20
65 57
51 47
45 14
2 93
35 96
82 1
12 24
29 32
55 39
94 10
72 72
55 39
1 49
91 96
72 20
87 51
38 54
8 31
27 1
4 66
76 46
80 76
95 41
43 0
68 77
72 20
39 70
88 10
46 46
44 15
13 29
96 71
77 71
89 92
42 37
80 97
95 28
40...

output:

6370

result:

ok single line: '6370'

Test #39:

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

input:

8 4990 100
14 9
80 53
83 86
44 8
14 3
7 9
80 53
83 53
97 49
32 87
26 99
15 46
85 52
84 36
64 60
65 1
27 91
96 1
98 85
39 52
89 89
24 31
86 33
24 31
95 91
85 52
8 21
65 1
99 24
65 1
49 33
89 89
55 89
49 33
63 49
42 38
81 93
93 84
1 21
92 46
15 46
65 1
28 57
15 46
36 68
79 93
35 47
68 67
18 1
1 21
41 ...

output:

5187

result:

ok single line: '5187'

Test #40:

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

input:

14 4986 100
29 2
93 96
24 83
72 7
14 21
30 67
14 97
93 46
4 97
4 96
35 19
35 21
3 67
94 28
92 91
41 92
84 30
52 55
25 0
69 77
58 99
82 87
96 77
41 45
12 82
98 24
17 76
41 57
84 33
90 70
43 14
10 56
73 40
47 89
31 32
68 13
80 75
85 34
2 20
37 64
89 99
45 56
13 63
63 71
33 12
48 63
97 74
50 90
83 52
8...

output:

6400

result:

ok single line: '6400'

Test #41:

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

input:

93 4907 100
0 99
84 42
16 64
26 58
71 41
89 48
97 32
52 86
53 82
22 93
14 88
59 60
74 89
80 90
13 23
98 81
85 16
83 23
94 67
92 69
67 70
45 25
96 68
27 53
69 85
82 20
64 62
30 35
3 56
68 73
21 47
55 14
31 71
6 55
50 76
24 13
2 31
19 54
39 77
93 15
40 27
11 49
87 26
63 40
12 78
66 30
34 83
17 8
43 43...

output:

9800

result:

ok single line: '9800'

Test #42:

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

input:

105 4890 100
43 92
62 32
28 25
60 15
30 26
13 68
32 91
81 79
92 86
50 24
89 41
67 6
46 89
64 96
79 88
44 50
20 17
61 71
72 30
90 21
25 1
78 0
70 70
19 23
14 51
40 13
41 38
63 35
4 61
83 77
8 63
15 74
23 2
36 89
37 9
1 14
18 69
93 33
75 20
68 54
33 82
77 90
87 31
48 46
21 67
80 73
94 78
97 37
65 27
8...

output:

10000

result:

ok single line: '10000'

Subtask #5:

score: 30
Accepted

Dependency #4:

100%
Accepted

Test #43:

score: 30
Accepted
time: 29ms
memory: 56320kb

input:

2177 2820 1179
466 319
573 622
600 85
945 644
562 633
938 7
927 733
1013 482
1154 741
152 1
1039 65
881 817
768 1122
1098 259
597 655
664 718
450 760
740 531
135 611
677 1010
125 1006
486 574
1178 355
29 193
1082 620
932 668
604 687
1128 335
125 166
489 935
1164 1010
945 449
538 1112
1034 1020
81 12...

output:

1370068

result:

ok single line: '1370068'

Test #44:

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

input:

1600 3395 99
77 41
93 85
93 41
59 80
33 87
71 12
98 36
45 94
3 85
51 41
93 41
70 5
14 30
98 30
28 5
46 12
65 80
75 94
28 14
12 69
72 80
14 80
71 85
45 5
78 94
25 80
59 94
27 41
78 95
97 6
98 94
97 26
77 36
28 85
85 26
46 5
14 6
51 14
34 94
65 17
12 36
34 75
28 14
87 36
79 95
70 12
34 5
3 94
87 12
59...

output:

8008

result:

ok single line: '8008'

Test #45:

score: 0
Accepted
time: 1342ms
memory: 200392kb

input:

10 4987 5000
1526 2823
1526 2823
1526 2823
1526 2823
1526 2823
1526 2823
1526 2823
1526 2823
1526 2823
1526 2823
2352 3844
1101 4084
916 3268
3844 2734
981 4364
4325 3619
3406 1376
734 1269
1564 3290
631 1898
4466 3014
4895 1964
3940 4162
3784 2147
2339 4571
4787 696
2375 4134
3650 2833
3399 4476
89...

output:

4991

result:

ok single line: '4991'

Test #46:

score: 0
Accepted
time: 1333ms
memory: 200160kb

input:

7 4992 5000
4180 3836
4180 3836
4180 3836
4180 3836
4180 3836
4180 3836
4180 3836
4557 1078
1650 4250
3313 2934
1946 3372
2804 2645
4563 838
1984 2944
1491 3014
1100 2879
1010 182
3834 1092
989 2116
1300 3659
456 1696
1991 104
1314 1597
2083 2548
3764 2589
1434 1068
4965 3823
3626 3099
1085 2684
344...

output:

4992

result:

ok single line: '4992'

Test #47:

score: 0
Accepted
time: 1343ms
memory: 200192kb

input:

7 4992 5000
2919 2686
2919 2686
2919 2686
2919 2686
2919 2686
2919 2686
2919 2686
1302 1403
2003 301
4107 2899
185 712
337 903
3549 1075
4811 3028
3324 2439
4748 4616
3518 4816
1806 3797
4479 2113
2008 802
1416 4188
2667 4499
3858 3050
4915 4755
1350 1504
2405 1429
1783 1786
3361 3533
2908 1366
1181...

output:

4992

result:

ok single line: '4992'

Test #48:

score: 0
Accepted
time: 1287ms
memory: 200248kb

input:

1 4998 5000
2583 4792
818 4335
198 790
1484 4497
3912 839
2932 4658
4749 4349
1343 4439
4784 3539
1756 4380
2827 1291
557 4341
3482 3548
919 1087
454 1534
1023 696
3574 3563
4585 2132
4287 4129
618 302
928 2158
609 2794
3602 2727
4616 2821
1975 4573
4175 1918
3012 4355
189 1707
4116 1907
3605 4810
3...

output:

4992

result:

ok single line: '4992'

Test #49:

score: 0
Accepted
time: 1302ms
memory: 200428kb

input:

9 4991 5000
1653 2463
960 4231
2078 2463
2078 4231
2078 3827
960 3827
1653 3827
1653 2463
1653 4231
1547 3417
426 4065
4241 3283
969 2434
1303 737
3557 747
2910 3702
2206 1360
3796 1395
3144 536
2614 4676
1717 3441
3769 4538
3704 1541
1146 3550
3102 4215
3327 2871
3989 4518
2125 3311
278 4469
839 25...

output:

5584929

result:

ok single line: '5584929'

Test #50:

score: 0
Accepted
time: 1288ms
memory: 200376kb

input:

7 4989 5000
1702 957
3439 193
1702 957
3439 937
3439 193
2717 193
3439 193
2015 1585
2029 2734
4096 4797
594 4556
4390 3446
2306 2478
1938 14
4623 1495
1018 4694
2003 3843
1793 3046
3426 358
3425 2507
878 3322
2562 3877
307 20
1923 4917
4020 2449
3646 1172
502 4831
225 3826
4543 4974
4489 2790
1295 ...

output:

3814290

result:

ok single line: '3814290'

Test #51:

score: 0
Accepted
time: 1255ms
memory: 200512kb

input:

15 4980 5000
225 1633
764 2590
2779 1633
4220 2803
2779 2803
764 4892
58 2803
4220 2803
58 2590
225 2803
764 2487
4220 4892
4220 2803
58 1633
764 2590
4611 2638
666 1545
2252 2046
4612 2260
4526 1470
71 3794
4653 2658
2801 841
2167 565
4573 3233
675 4039
1205 1448
4216 536
371 4493
3161 1862
3582 33...

output:

14507584

result:

ok single line: '14507584'

Test #52:

score: 0
Accepted
time: 1248ms
memory: 200292kb

input:

7 4989 5000
3567 2033
506 117
4634 1977
2794 1977
2692 4146
2794 2033
506 4717
1767 213
1204 706
4637 82
3376 388
1923 3187
2286 2847
2686 329
3185 4010
3885 2565
1258 3805
1355 4974
2599 3537
1938 3862
1659 3670
1060 3252
3213 3313
379 1815
3826 1944
2134 9
3773 3103
2495 165
1967 2822
3400 2202
46...

output:

14021515

result:

ok single line: '14021515'

Test #53:

score: 0
Accepted
time: 1219ms
memory: 200352kb

input:

14 4983 5000
1625 590
4804 4870
4420 590
3384 3933
1561 4870
1561 4870
1561 3556
3384 590
4420 639
1561 639
4420 590
1625 3556
1561 3556
4420 4870
1675 4185
1558 352
1048 2353
3273 1734
2583 811
2263 797
2826 2172
841 762
1016 717
4572 3019
4742 494
2214 1648
981 1237
4786 2437
3623 861
3463 1824
23...

output:

10399160

result:

ok single line: '10399160'

Test #54:

score: 0
Accepted
time: 1207ms
memory: 202916kb

input:

79 4919 5000
4558 2508
809 1554
463 17
542 1659
121 1749
3603 3551
3154 4217
97 4897
3046 1222
2156 611
429 1850
3081 3761
1902 3921
2421 4715
4415 3776
2709 547
1798 466
4281 4234
4415 2385
4909 4427
1188 2584
3702 4136
2579 1853
3545 4105
3266 998
1440 4731
1015 424
3266 231
4606 2947
3526 740
496...

output:

22831718

result:

ok single line: '22831718'

Test #55:

score: 0
Accepted
time: 1199ms
memory: 203000kb

input:

77 4923 5000
1490 2825
739 2257
4258 4055
3599 1540
1340 2120
256 2468
1157 3393
1942 3287
1204 4854
3236 2256
324 4602
1335 4111
1340 1256
257 4666
2266 1120
444 3120
2084 2083
3240 1127
4752 300
1398 747
2607 1127
4416 423
3317 2603
1762 597
1975 3722
1254 980
4021 3701
848 2399
2325 300
2054 1367...

output:

23027679

result:

ok single line: '23027679'

Test #56:

score: 0
Accepted
time: 417ms
memory: 359888kb

input:

4990 10 5000
1085 2836
3488 1109
219 4389
3811 3750
3730 3155
2587 1255
3937 2123
557 1335
161 2981
4162 8
3694 3393
271 4644
3687 3010
2679 1222
1372 3884
1841 1139
3675 2407
997 1577
292 1220
1105 3986
1347 945
2865 2021
2430 66
137 2349
385 1557
4760 401
2486 4850
2745 3453
1655 1668
3796 1679
43...

output:

24990001

result:

ok single line: '24990001'

Subtask #6:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #57:

score: 25
Accepted
time: 293ms
memory: 149892kb

input:

430267 69726 3026
820 1453
675 475
401 2411
1741 2648
1673 2998
1426 1486
608 573
907 2742
605 2269
2462 2645
2134 810
1865 1373
2068 250
1975 2259
608 2930
1470 496
797 919
2134 2456
890 1480
1741 799
1865 2031
2554 455
1934 2478
1426 430
821 2478
1470 961
308 544
90 596
1308 126
538 1690
1382 2539...

output:

8870406

result:

ok single line: '8870406'

Test #58:

score: 0
Accepted
time: 139ms
memory: 98680kb

input:

52673 447322 2084
1991 194
845 433
1352 1397
828 811
1873 126
287 1583
220 1040
1365 5
80 1693
1998 731
1412 1825
401 985
591 1935
1043 942
1562 301
390 1008
651 1258
1307 666
845 1364
262 317
82 592
1548 1215
684 735
2082 2016
287 848
1999 1864
676 1194
1660 609
392 530
1715 1
737 1123
805 1216
634...

output:

4278672

result:

ok single line: '4278672'

Test #59:

score: 0
Accepted
time: 1251ms
memory: 205324kb

input:

1 499997 5000
3769 1629
1227 2975
2284 536
245 1842
2799 4323
123 140
4528 2584
2045 4629
270 2210
1113 1508
4444 502
1753 2001
4494 1978
4102 3320
3077 396
2025 1440
4299 3208
3873 3401
4331 4581
3330 4496
2956 3595
1239 859
826 1061
2217 407
3347 3885
664 1527
2945 2755
2933 4088
2559 3792
1811 39...

output:

5000

result:

ok single line: '5000'

Test #60:

score: 0
Accepted
time: 1223ms
memory: 205368kb

input:

5 499994 5000
3639 2652
3639 2652
3639 2652
3639 2652
3639 2652
3366 1600
1447 3920
4682 1360
1454 4511
3439 2202
4550 4872
1112 1903
510 2235
4519 3748
3126 3359
676 1590
1475 1666
1181 3241
1456 2228
3932 1520
2671 972
334 2760
2171 1962
3089 1702
442 2343
4734 3453
4911 3475
2520 3642
2924 4576
1...

output:

5000

result:

ok single line: '5000'

Test #61:

score: 0
Accepted
time: 1315ms
memory: 202832kb

input:

8 499987 5000
2989 3064
2989 3064
2989 3064
2989 3064
2989 3064
2989 3064
2989 3064
2989 3064
1610 173
3079 1539
158 1829
4976 4139
2955 4870
2763 2677
1435 2695
4704 4901
370 2657
2357 2050
1414 4471
2689 3297
741 595
4140 4905
519 3024
3885 4164
1629 1617
1535 2927
1823 2725
2774 3474
1503 1858
23...

output:

4999

result:

ok single line: '4999'

Test #62:

score: 0
Accepted
time: 1340ms
memory: 202744kb

input:

4 499992 5000
3756 1848
3756 1848
3756 1848
3756 1848
4794 1495
2210 3629
4530 3830
2436 4024
4730 3297
384 3179
943 4017
4187 4010
3542 1056
867 222
187 815
4572 2419
427 4039
3793 4550
3515 2895
1496 771
2797 4490
194 4789
2836 2480
4872 4427
4306 1578
4342 431
2267 2114
1063 6
85 3141
3238 2857
2...

output:

4993

result:

ok single line: '4993'

Test #63:

score: 0
Accepted
time: 1222ms
memory: 205532kb

input:

9 499990 5000
2216 1673
296 4938
296 4938
3754 1673
2216 1673
296 4938
3754 1673
296 331
2216 4938
79 1669
1496 3992
365 2403
3251 1897
443 3972
4066 3564
1463 4275
3638 2737
3616 2959
324 837
2956 3246
2451 2584
1147 3662
395 3190
4348 2757
871 4452
3691 2918
3786 2388
4714 1391
621 2387
3053 1212
...

output:

8680000

result:

ok single line: '8680000'

Test #64:

score: 0
Accepted
time: 1212ms
memory: 202756kb

input:

13 499986 5000
2205 2195
4019 160
4019 3710
4019 160
500 3710
4019 160
2205 3710
500 160
4019 160
4019 3710
4019 160
2205 2195
500 3710
3888 1604
2562 3067
1685 3225
352 929
1743 3321
4617 4205
160 3731
1816 4356
456 1062
2679 1792
126 1298
1189 4867
3815 1297
345 2273
2800 4120
373 1296
4610 1556
9...

output:

14821102

result:

ok single line: '14821102'

Test #65:

score: 0
Accepted
time: 1219ms
memory: 205572kb

input:

6 499989 5000
3139 1929
2494 471
717 2749
2133 345
2494 431
4226 1929
226 3348
3564 1875
476 3475
550 1176
3322 230
3413 199
829 664
975 4612
3548 3875
4647 3663
2592 1834
2253 2854
2434 4070
511 2286
1933 88
4234 1070
2826 4392
3042 2276
876 1512
3510 3050
3393 4023
3509 2445
4633 2872
484 2403
470...

output:

12025000

result:

ok single line: '12025000'

Test #66:

score: 0
Accepted
time: 1212ms
memory: 202756kb

input:

5 499995 5000
3215 1207
2509 917
2516 2382
856 3194
3938 2153
1700 58
3788 1903
4130 3898
2013 926
2949 2005
222 3691
325 3110
4644 2783
2208 3698
860 1595
716 1573
3301 3357
2204 1102
2203 1454
972 2726
3797 4651
127 710
1464 3139
1651 2883
4896 2481
2990 2770
3762 2483
2241 2356
63 2164
1907 927
2...

output:

11385444

result:

ok single line: '11385444'

Test #67:

score: 0
Accepted
time: 1263ms
memory: 202980kb

input:

13 499983 5000
828 2841
2873 2841
2873 2397
784 2342
784 2397
4916 2869
828 2841
2873 2342
4151 843
4916 2342
784 2841
4916 2841
4151 843
938 3604
2722 3040
998 1589
189 2454
3323 3675
3886 128
4102 3363
2814 2800
4157 4266
1565 1779
2762 3666
4085 685
422 4290
1935 2044
3327 145
3963 3857
518 1658
...

output:

10118784

result:

ok single line: '10118784'

Test #68:

score: 0
Accepted
time: 1180ms
memory: 205396kb

input:

77 499922 5000
2205 3268
3218 3940
2541 4637
15 171
671 3205
1899 2422
3792 1584
1702 3418
3669 1084
2025 4202
3863 1547
1293 581
3121 3940
3398 3333
2115 58
745 3377
4444 2396
4742 3317
3551 4710
718 3466
2632 3771
4903 3754
3211 2794
1698 773
1213 2502
43 3235
1987 3310
3264 3803
1042 867
4458 257...

output:

22560000

result:

ok single line: '22560000'

Test #69:

score: 0
Accepted
time: 1163ms
memory: 205388kb

input:

73 499924 5000
3286 3382
2375 4335
1484 2970
98 2247
422 2141
4509 2107
1762 412
3546 864
402 1549
1081 3238
4951 871
177 243
1184 2425
210 61
2024 3186
3538 837
1644 1711
1725 3552
1320 498
2518 4135
895 26
98 1139
3384 876
1479 4505
291 3947
1753 2422
857 1987
3721 936
4509 4829
2816 1485
2084 133...

output:

23475304

result:

ok single line: '23475304'

Test #70:

score: 0
Accepted
time: 500ms
memory: 361852kb

input:

4995 495001 5000
2452 2527
3165 4732
3253 3251
626 4447
3992 1639
3875 2812
2375 4927
4965 3494
2856 328
2149 1304
3934 1339
842 4861
884 2314
663 3597
4249 1482
4614 4884
4006 945
4580 148
3239 874
1806 2639
4641 4717
135 3482
4161 1521
2030 1775
4045 4955
3690 71
3705 8
4112 3698
3977 4725
1761 33...

output:

24990000

result:

ok single line: '24990000'

Test #71:

score: 0
Accepted
time: 462ms
memory: 361512kb

input:

5008 494989 5000
4928 901
738 3117
4696 2990
3700 2533
87 2931
403 180
389 2120
261 1910
1157 2373
1304 4038
3702 2278
3025 4535
2196 3477
1456 4917
4300 582
1083 4847
1647 2217
902 1568
1988 2380
3692 3173
3127 3041
4902 1195
530 3769
754 875
1282 4619
1536 77
1610 2927
2532 136
4405 4081
1053 3909...

output:

25000000

result:

ok single line: '25000000'

Extra Test:

score: 0
Extra Test Passed