QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#137304#2358. What? Subtasks? Again?freshmen#AC ✓15ms11252kbC++14789b2023-08-10 10:03:362023-08-10 10:03:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-10 10:03:39]
  • 评测
  • 测评结果:AC
  • 用时:15ms
  • 内存:11252kb
  • [2023-08-10 10:03:36]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
int n,m,k,ls,fl;
int c[200000],f[200000],ds[8],chk[200000][8],sur[200000],nb[8];
void dfs(int x){
	if(x==6){
		int ans=0;
		for(int i=1;i<=5;++i){
			if(ds[i]==1){
				for(int j=1;j<=nb[i];++j){
					sur[chk[j][i]]=1;
				}
			}
		}
		for(int i=1;i<=n;++i) if(sur[i]==0) ++ans;
		if(ans<=m){fl=1;ls=max(ls,ans);}
		for(int i=1;i<=n;++i) sur[i]=0;
		return;
	}
	ds[x]=0;dfs(x+1);ds[x]=1;dfs(x+1);
	return;
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=k;++i){
		scanf("%d%d",&c[i],&f[i]);
		chk[++nb[f[i]]][f[i]]=c[i];
	}
	dfs(1);
	if(fl==1) printf("%d\n",ls);
	else printf("Round will be unrated");
	return 0;
} 

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5932kb

input:

10 7 10
2 1
3 5
2 1
4 1
9 5
5 4
6 4
7 4
8 4
10 4

output:

6

result:

ok single line: '6'

Test #2:

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

input:

10 9 0

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #3:

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

input:

5 4 3
4 1
4 2
1 2

output:

4

result:

ok single line: '4'

Test #4:

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

input:

2 1 2
1 1
2 1

output:

0

result:

ok single line: '0'

Test #5:

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

input:

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

output:

1

result:

ok single line: '1'

Test #6:

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

input:

5002 4187 25010
4625 3
2753 4
1909 5
2193 3
1939 1
2193 5
269 5
2802 3
3616 2
218 5
2969 5
1644 4
235 3
3045 5
2434 4
3582 4
886 5
2144 1
1968 3
2158 3
585 3
1102 2
3309 1
2157 2
2703 3
4627 5
2593 2
1705 5
508 5
4430 3
2900 2
2445 3
1351 1
3486 5
4910 1
3970 1
3573 4
4541 4
3726 4
291 2
1720 5
4371...

output:

1855

result:

ok single line: '1855'

Test #7:

score: 0
Accepted
time: 7ms
memory: 6256kb

input:

10002 273 50010
4756 5
4869 4
6441 3
7925 2
4945 2
9051 4
7660 4
9008 1
530 3
9609 3
5984 4
6590 1
1373 5
3462 4
5632 1
2733 3
4579 2
6421 5
2772 1
3238 5
3872 4
6837 4
9778 5
8566 1
2837 5
1125 2
3490 1
3730 2
567 1
3041 1
968 3
5109 4
5980 4
7420 4
9707 2
8285 2
4935 1
2613 5
6436 2
335 4
4731 5
9...

output:

196

result:

ok single line: '196'

Test #8:

score: 0
Accepted
time: 11ms
memory: 8500kb

input:

15002 2614 75010
14907 1
1958 4
12546 3
2096 3
13049 2
14539 5
10052 4
6702 2
3627 3
13533 4
13516 5
4318 4
1865 5
12993 5
8522 2
4054 1
119 1
8945 4
4167 3
7430 5
13710 1
3365 4
12529 2
2679 2
13712 2
3221 1
4048 1
11846 3
8662 3
5624 4
6456 4
12213 4
4225 4
6151 2
2184 4
4655 3
9669 3
8595 3
1439 ...

output:

2062

result:

ok single line: '2062'

Test #9:

score: 0
Accepted
time: 10ms
memory: 8712kb

input:

20002 10951 100000
19547 4
10040 5
11067 5
9921 2
14203 2
2767 1
4725 1
10489 1
14592 1
19256 5
17923 2
7327 1
17819 1
3252 3
2655 1
13575 3
14108 3
13960 4
3444 1
7069 3
10678 2
19547 2
9120 3
823 2
19037 3
6521 3
2140 4
4640 1
13331 2
17106 5
16296 1
19273 4
13802 2
7429 5
14138 2
4659 1
5707 5
77...

output:

7515

result:

ok single line: '7515'

Test #10:

score: 0
Accepted
time: 13ms
memory: 6576kb

input:

25002 2082 100000
2850 3
22753 5
16284 5
4114 4
829 3
21016 3
1847 4
9004 5
4049 4
3154 5
15878 3
24708 5
9397 1
3886 3
9459 2
24719 4
4085 4
16342 2
1990 4
13645 4
2310 3
5794 3
2555 5
6283 2
4037 4
12834 4
14242 3
18777 2
2622 5
17939 1
7074 4
24375 1
8515 3
23797 5
16973 4
3729 4
24356 5
16179 3
...

output:

1051

result:

ok single line: '1051'

Test #11:

score: 0
Accepted
time: 9ms
memory: 6596kb

input:

30002 23435 100000
26132 2
15461 5
22843 5
4392 5
3639 3
28357 3
27639 3
11808 2
14082 1
12121 3
22758 5
6414 1
29374 2
7254 1
29404 2
14164 1
16867 3
23420 5
2370 2
16399 2
27167 3
8446 5
19725 1
17011 4
24688 2
2420 3
12172 2
29043 2
15661 5
19021 5
5669 2
1295 4
17852 4
6733 5
6040 4
18266 3
2329...

output:

15604

result:

ok single line: '15604'

Test #12:

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

input:

35002 13584 100000
11000 3
7243 3
20459 3
10543 4
9946 4
31024 3
15716 4
26674 3
24030 5
25794 3
15371 2
25279 2
28522 3
4125 5
18945 4
11494 2
26362 4
7071 5
7963 2
23848 2
17273 1
26167 2
1767 3
18595 3
34255 1
24125 3
5823 2
10493 2
19757 5
19129 5
6085 2
21070 5
20138 1
17274 3
13281 5
8033 2
52...

output:

11284

result:

ok single line: '11284'

Test #13:

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

input:

40002 28511 100000
32029 2
37293 2
5141 1
27129 5
20859 3
36580 1
3412 1
24047 4
3505 1
38988 2
31611 4
29272 3
38853 1
32333 2
6854 1
19977 1
23748 3
36527 1
14064 1
31813 1
5239 2
33514 1
21455 4
30714 3
4606 5
37412 4
4879 3
35581 4
21725 1
29300 2
21161 4
21050 1
12683 3
37471 2
32780 1
3424 5
1...

output:

24377

result:

ok single line: '24377'

Test #14:

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

input:

45002 13546 100000
29032 5
11149 4
29609 2
9910 4
4347 1
20998 4
14328 2
30670 5
22463 4
26523 3
30517 3
17050 3
36222 5
15972 4
44052 2
4561 3
30533 4
15774 5
19104 3
27049 2
38104 3
1170 4
42630 2
5055 1
2188 1
41496 3
37911 3
32365 2
18260 4
24634 1
35997 5
31634 2
9021 3
3259 1
34837 3
13312 1
2...

output:

12098

result:

ok single line: '12098'

Test #15:

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

input:

50002 15380 100000
27326 1
12058 3
14454 3
28471 3
32202 3
13387 1
45965 5
12226 2
40648 1
45627 4
8234 3
23856 4
14858 5
20870 1
22109 2
11905 1
20218 1
25564 2
24013 4
11542 3
46984 2
2598 2
31512 3
48788 5
14029 4
49277 4
17548 2
15478 3
13694 4
37595 1
36461 2
14475 2
22118 4
26906 3
49262 5
427...

output:

15088

result:

ok single line: '15088'

Test #16:

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

input:

55002 42 100000
3090 1
15680 1
40190 5
19693 2
22447 5
31117 1
12457 4
54221 1
17536 2
52348 3
51244 1
33652 2
2447 1
21089 1
33809 5
29222 3
44216 2
18881 5
10972 1
42597 2
19577 2
37333 5
28276 2
2130 4
32841 2
9671 5
49692 5
4783 3
23127 1
23391 3
36531 3
13231 3
6576 2
9631 3
20368 3
37011 3
301...

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #17:

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

input:

60002 6410 100000
59220 2
23765 5
34495 2
28299 1
59148 1
20810 2
33854 3
31590 3
54572 1
4706 3
25091 1
51358 4
6229 1
5843 2
54358 5
20788 1
54174 2
33498 5
28071 4
4345 5
17789 3
57201 1
10140 3
36851 5
42997 3
4947 3
25126 2
9904 3
2800 3
42152 1
7953 2
25823 4
715 3
30310 5
524 3
2486 1
55055 4...

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #18:

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

input:

65002 41926 100000
20892 3
11718 2
26535 2
49338 2
17564 2
53218 5
13053 5
41689 5
21016 4
39260 3
43214 2
4966 1
50738 2
47059 5
35084 1
1761 3
31629 2
50156 4
45208 2
38180 5
33093 1
5907 3
4440 2
59358 5
37084 5
62323 1
31042 4
19414 1
30224 3
36613 5
64862 3
3182 3
11059 2
55040 1
64818 4
22766 ...

output:

35340

result:

ok single line: '35340'

Test #19:

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

input:

70002 43399 100000
51118 1
20997 3
34588 2
62790 2
38582 5
20784 3
20675 4
11078 1
5965 1
35986 1
41487 5
50988 1
26119 1
29837 3
497 1
52110 4
14801 2
9887 1
57475 5
6434 4
8539 5
59089 3
2026 4
7918 3
41834 1
38514 5
13754 5
14665 4
40852 3
16487 4
52985 4
36830 3
27574 5
26119 2
36561 3
22724 3
5...

output:

39679

result:

ok single line: '39679'

Test #20:

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

input:

75002 40251 100000
25446 5
67816 2
26785 1
28132 4
28198 2
6364 3
37664 4
6830 3
16960 3
72455 2
66888 3
17716 3
6354 3
47413 3
61200 4
43755 5
32296 2
57154 1
33579 4
8178 5
55122 4
63181 1
1492 3
61537 1
18112 3
23069 5
44105 5
19867 4
31579 2
13993 4
14775 2
74519 2
66112 1
9574 2
44439 2
15378 5...

output:

33941

result:

ok single line: '33941'

Test #21:

score: 0
Accepted
time: 9ms
memory: 7760kb

input:

80002 21263 100000
71768 2
39583 3
44643 5
58566 4
79389 4
64041 1
51258 4
36091 4
36358 4
76076 2
43996 5
31055 4
55920 5
42392 5
12662 3
27537 1
10880 4
65435 4
27156 1
2511 4
23128 1
46570 2
70491 1
15349 2
36176 2
47371 4
77192 2
47991 5
35975 1
76542 4
9180 4
12584 5
9267 1
25825 1
69169 2
5582...

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #22:

score: 0
Accepted
time: 11ms
memory: 6832kb

input:

85002 51597 100000
70924 5
71619 4
47778 2
80360 4
64103 3
57059 3
45400 3
29852 2
25416 5
42445 5
19353 3
10646 4
83602 1
1195 3
2550 5
60475 4
67737 1
61322 3
72820 5
51095 1
47427 2
81693 4
65281 3
15639 2
28241 2
38071 4
23903 4
4355 2
21870 5
75597 5
74608 4
70987 1
4784 2
73825 2
53592 4
37920...

output:

42149

result:

ok single line: '42149'

Test #23:

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

input:

90002 24768 100000
21683 5
67056 4
69084 3
82100 1
75604 3
80088 2
32920 5
38469 3
67982 2
12042 3
32272 5
36471 2
43257 3
29835 2
45062 2
32822 4
54566 2
49998 2
46092 1
14236 5
48737 5
32191 5
1316 1
60204 5
19781 1
37633 5
81732 2
36340 1
8541 1
23986 1
40625 2
27968 5
14687 5
11252 3
5826 1
3330...

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #24:

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

input:

95002 30317 100000
35073 5
61648 1
38377 1
32093 3
38497 4
70101 2
74093 5
2210 5
78667 3
2037 2
88705 4
61660 2
2925 1
59744 5
29628 5
31117 4
61749 2
59955 1
90276 1
30273 1
3976 4
10326 3
28709 5
3450 2
2453 1
88358 3
50946 2
56105 1
82317 2
50346 1
57989 1
36461 5
86820 2
89228 2
91133 2
8002 5
...

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #25:

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

input:

100000 41104 100000
6721 1
71130 3
19562 2
30821 3
31358 3
63765 5
55620 2
94162 5
788 5
64299 4
45550 3
59696 2
85369 4
95236 2
29377 2
6819 1
88155 5
39282 3
7191 1
81779 3
68603 4
79721 3
41150 2
75266 5
98430 4
89361 1
8715 3
43234 1
60048 4
47867 4
78222 5
72318 5
62567 1
67650 3
21639 3
35199 ...

output:

36845

result:

ok single line: '36845'

Test #26:

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

input:

100000 54260 100000
63043 5
18020 1
56886 4
47058 2
64621 2
45254 3
92094 4
16980 5
69716 5
18543 3
53903 3
85082 5
12914 4
79495 2
29861 4
85125 3
17558 5
54569 5
32351 5
64026 1
53248 2
30769 4
9178 1
66888 1
74980 5
89085 1
24906 5
72555 3
37090 1
50705 4
19150 5
37558 5
96260 3
64131 4
75449 5
2...

output:

45117

result:

ok single line: '45117'

Test #27:

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

input:

100000 38938 100000
74164 5
35980 3
1902 1
75901 1
71833 1
4456 4
54978 4
4896 3
58907 1
24250 5
40460 1
13104 1
2981 3
50446 2
94822 5
39734 2
60203 3
99820 2
16785 3
32478 1
74953 3
29111 2
88934 2
89210 3
59236 3
69301 1
23271 1
22732 4
27737 1
81174 1
54792 4
88053 4
42982 1
34475 1
47952 3
9512...

output:

36962

result:

ok single line: '36962'

Test #28:

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

input:

100000 78688 100000
82530 2
35201 2
65817 3
7304 2
59606 2
75749 5
65476 1
97347 3
69928 5
43640 1
56540 3
49740 1
63972 5
58815 5
15831 1
34574 5
20827 3
98365 2
50164 3
43231 1
69966 4
10044 4
67404 3
39786 2
66719 3
20587 5
2658 4
77496 3
87908 5
1353 1
37212 5
5208 2
6629 1
31214 4
62841 5
6682 ...

output:

67282

result:

ok single line: '67282'

Test #29:

score: 0
Accepted
time: 11ms
memory: 6872kb

input:

100000 36497 100000
5851 1
1942 3
37904 3
90403 4
86046 2
3379 5
1564 4
80984 2
50566 5
52758 1
50338 2
15777 2
58559 2
38004 2
56532 3
30060 3
25638 2
12974 2
46745 5
33015 3
21723 4
45031 3
81904 3
86581 2
60959 5
95582 4
45634 5
74528 4
50712 2
26519 5
81614 2
12809 4
94595 3
60271 1
44075 3
3894...

output:

Round will be unrated

result:

ok single line: 'Round will be unrated'

Test #30:

score: 0
Accepted
time: 7ms
memory: 6872kb

input:

100000 97571 100000
43038 5
31110 4
13388 5
55844 3
7565 2
72797 1
20482 2
4204 3
40870 4
84324 2
510 2
63646 3
55742 2
9057 5
83099 4
88521 3
26885 5
93130 4
35705 5
44052 3
47594 3
37377 2
49866 1
86429 4
52624 5
31184 3
31935 5
82062 3
86469 4
81602 5
88781 3
64837 2
87801 3
82815 2
87620 2
85187...

output:

82013

result:

ok single line: '82013'

Test #31:

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

input:

100000 98375 100000
81853 2
74782 4
58987 1
47380 4
54291 5
44133 5
73428 2
65708 3
38349 5
52497 1
68329 5
56796 5
91470 3
33368 1
49494 4
93919 5
96377 4
87585 1
20690 3
1857 2
55493 3
36846 4
25975 2
29987 5
60673 4
37818 2
51453 2
59726 2
67881 2
46695 3
44316 3
52356 2
42478 5
28983 2
7570 5
47...

output:

81959

result:

ok single line: '81959'

Test #32:

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

input:

100000 69663 100000
69221 4
21655 4
84085 2
73243 1
97806 2
9237 2
9886 4
23978 2
64807 2
11694 1
39979 3
65546 2
23284 4
47440 2
35504 5
34417 4
96646 1
27234 4
95049 2
98668 5
674 4
27506 5
14258 1
49620 4
54692 1
22432 1
71455 3
20567 2
32610 5
24854 5
48663 5
67549 1
99188 4
27334 3
20804 5
2180...

output:

67205

result:

ok single line: '67205'

Test #33:

score: 0
Accepted
time: 11ms
memory: 7112kb

input:

100000 78712 100000
27983 3
21520 2
50143 2
95962 1
58941 1
5451 3
72659 1
37519 3
50068 5
99841 1
79422 5
51335 5
27557 2
976 2
1338 1
11520 4
94485 2
35961 3
3177 1
63838 3
30336 3
54343 4
18081 1
58457 4
10739 1
8653 5
81761 5
15293 5
57038 5
9848 3
53142 1
56608 3
19103 2
68924 3
95322 2
76459 1...

output:

67156

result:

ok single line: '67156'

Test #34:

score: 0
Accepted
time: 11ms
memory: 9024kb

input:

100000 49169 100000
95706 5
93946 4
43206 1
12326 3
44445 5
63679 4
7505 2
92251 2
72512 5
86362 2
93144 5
84241 3
62367 3
60707 2
49337 3
33974 5
5099 1
19969 1
6649 3
28862 4
33930 1
57821 1
75605 3
78088 1
13875 1
8150 2
67010 2
99680 2
22915 4
29067 5
36973 1
32104 2
18303 4
25124 1
55144 2
9412...

output:

45249

result:

ok single line: '45249'

Test #35:

score: 0
Accepted
time: 7ms
memory: 9216kb

input:

100000 93567 100000
5846 5
68056 1
90894 1
54371 1
16562 4
9188 5
17937 5
23696 1
5798 3
68256 1
47949 5
21931 1
71339 5
84026 1
89974 2
68088 2
69702 4
13728 1
67193 3
29963 2
94401 4
5069 3
67072 2
73789 4
70685 1
28227 2
39714 4
85067 1
76126 2
30038 1
89597 3
84098 1
11431 1
18441 5
69221 3
4380...

output:

82040

result:

ok single line: '82040'

Test #36:

score: 0
Accepted
time: 7ms
memory: 7980kb

input:

100000 77168 100000
81427 2
85255 1
82939 5
91541 4
90268 4
97661 5
22330 5
7927 5
8299 5
28049 5
50918 1
99564 5
27840 5
25369 3
65581 2
7915 4
73728 1
36340 2
80765 1
98248 3
88200 3
94793 1
951 1
28093 1
22966 3
53383 3
61190 4
58667 5
80914 4
4700 1
93351 4
31462 1
68077 1
28947 3
22199 1
68888 ...

output:

67127

result:

ok single line: '67127'

Test #37:

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

input:

100000 80861 100000
97019 5
92316 5
25781 5
5007 4
17417 2
72531 3
96192 3
12124 3
87614 2
4153 2
58758 1
19067 3
87547 1
82806 2
80340 5
64367 4
33367 1
68745 5
46808 5
13888 2
77249 2
95589 5
64970 3
15537 4
73322 3
51109 1
24555 4
38776 2
70359 2
31630 1
19329 2
75841 2
22452 1
56580 4
15356 3
99...

output:

67258

result:

ok single line: '67258'

Test #38:

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

input:

100000 96528 100000
41250 3
30334 4
40455 1
74108 5
43238 2
25724 5
83934 1
61546 5
7241 3
59562 4
54446 2
76350 1
40449 3
76004 5
83685 4
93494 2
36234 2
17682 5
19373 4
1356 3
19298 4
33580 1
24102 5
83510 2
47750 4
64354 5
51866 5
78613 1
12492 5
45969 2
54350 2
43781 3
68746 5
12523 3
99198 5
38...

output:

81964

result:

ok single line: '81964'

Test #39:

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

input:

100000 76292 100000
88933 2
67274 2
76418 1
23540 2
20187 5
81677 4
78435 5
77540 3
3488 2
99020 2
5306 3
61808 3
76620 2
12799 5
39750 5
11018 2
41613 2
90249 3
89019 2
13400 5
69137 2
93186 2
9847 4
29026 4
72704 5
80611 3
38925 4
56895 3
53094 4
93358 2
52993 2
94901 5
69652 4
50498 3
16684 5
724...

output:

67104

result:

ok single line: '67104'

Test #40:

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

input:

100000 77888 100000
33137 5
2939 1
26728 5
93042 2
49286 1
5545 4
79589 1
20566 2
27328 1
79086 5
48458 2
6371 3
34776 1
67290 4
88384 1
45906 1
22562 1
96790 2
60278 1
332 5
16783 5
59534 2
3648 2
71216 5
45252 3
39521 1
17097 4
30112 5
5021 3
56643 3
41706 3
86889 3
31765 1
226 5
29562 2
25441 5
1...

output:

67188

result:

ok single line: '67188'

Test #41:

score: 0
Accepted
time: 7ms
memory: 7056kb

input:

100000 81500 100000
87904 2
44575 5
20156 2
57392 1
32987 4
81971 2
64358 1
66507 4
22994 5
29307 2
77164 2
17980 3
86016 4
53638 1
48531 4
55659 1
23894 1
24379 5
45032 4
39326 5
16600 1
53433 4
85627 2
84363 1
63692 2
4142 5
77379 4
28601 2
57909 2
62362 2
89112 4
40046 5
93969 2
22280 2
38856 5
2...

output:

67048

result:

ok single line: '67048'

Test #42:

score: 0
Accepted
time: 8ms
memory: 6848kb

input:

100000 94709 100000
78749 2
30782 5
63809 1
92459 1
45107 4
61089 4
61824 5
50053 2
10311 3
42102 3
19286 4
38393 1
69259 1
47234 1
52346 4
219 1
37083 1
6513 4
6462 3
55173 5
42330 1
73852 1
28251 2
71033 3
63902 1
68394 4
32582 5
64166 1
68596 4
98635 2
26880 1
23926 3
48541 5
78418 5
42840 3
1385...

output:

82058

result:

ok single line: '82058'

Test #43:

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

input:

100000 96446 100000
21668 1
42630 2
53813 3
19382 3
59574 1
95420 4
34363 1
64645 3
15820 3
94601 4
19008 1
48990 2
38201 4
51668 2
39904 4
5900 3
19425 4
62771 1
2127 5
39205 3
40201 4
27414 2
5675 2
39942 5
78595 2
97416 3
79807 5
20698 4
79593 1
30575 4
32125 4
51620 2
61856 3
54648 1
94669 4
928...

output:

82063

result:

ok single line: '82063'

Test #44:

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

input:

100000 96129 100000
2415 3
76639 3
50244 3
89240 1
94684 4
5545 2
72518 1
25057 1
58732 4
11141 2
47155 4
91157 4
77576 2
24386 1
46141 4
70270 4
78729 4
52940 1
11317 2
69446 1
1934 4
51686 1
2368 5
33955 2
26296 1
20530 2
70966 3
53396 2
60542 5
25080 3
39084 2
29815 2
61024 3
79951 5
79399 1
8409...

output:

82039

result:

ok single line: '82039'

Test #45:

score: 0
Accepted
time: 10ms
memory: 11252kb

input:

100000 99999 100000
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
...

output:

99999

result:

ok single line: '99999'