QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#761839#5016. Range Minimum ElementNineSuns100 ✓106ms18504kbC++142.3kb2024-11-19 10:39:432024-11-19 10:39:44

Judging History

This is the latest submission verdict.

  • [2024-11-19 10:39:44]
  • Judged
  • Verdict: 100
  • Time: 106ms
  • Memory: 18504kb
  • [2024-11-19 10:39:43]
  • Submitted

answer

#include <bits/stdc++.h>
#define ll long long
#define pii pair <int, int>
#define fi first
#define se second
#define pb push_back
#define int long long

using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 105, mod = 998244353, inf = 0x3f3f3f3f; 
int n, m, c, f[N][N][N], s[N][N], sf[N][N][N], ps[N][N], ns[N][N]; 
vector <int> td[N];  
int qpow (int x, int y = mod-2) {
	int res = 1;
	while (y) {
		if (y&1) res = res*x%mod;
		x = x*x%mod; y >>= 1;
	}
	return res; 
}
void sol (int l, int r) {
	int fl = !ps[l][r];  
	if (fl) {
		for (int i = 0;i <= n;i++) {
			f[l][r][i] = 1; 
			if (s[l][r]) for (int j = 1;j <= l;j++) (sf[j][r][i] += f[l][r][i]) %= mod; 
			
			return; 
		}
	}
	
	for (int p = 1;p <= n;p++) {
		for (int i = l;i <= r;i++) (f[l][r][p] += sf[l][i][p-1]*(!ps[i+2][r] ? 1 : f[i+2][r][p])) %= mod; 
		int ds = 1; 
		for (int i = l;i <= r;i++) {
			int j = ns[i][r]; 
			if (j) ds = ds*f[i][j][p-1]%mod, i = j; 
		}
		(f[l][r][p] += f[l][r][p-1]-ds+1) %= mod; 
		if (s[l][r]) for (int i = 1;i <= l;i++) (sf[i][r][p] += f[l][r][p]) %= mod; 
	}
}
 
void solve () {
	cin >> n >> m >> c; 
	for (int i = 1;i <= m;i++) {
		int l, r; cin >> l >> r; 
		td[r].pb(l); 
		ps[l][r]++; 
	}
	for (int i = 1;i <= n;i++) {
		for (int j = i;j <= n;j++) ps[i][j] += ps[i][j-1]; 
	}
	for (int i = 1;i <= n;i++) {
		for (int j = i;j >= 1;j--) ps[j][i] += ps[j+1][i]; 
	}
	for (int i = 1;i <= n;i++) {
		int sl = inf, lst = i; 
		for (int j = i;j <= n;j++) {
			int ml = 0;  
			for (int z : td[j]) {
				if (z >= i && lst >= z) lst = j+1; 
				ml = max(ml, z); 
				sl = min(sl, z); 
			}
			if (lst > j) s[i][j] = 1; 
		}
	}
	for (int i = 1;i <= n;i++) {
		for (int j = i;j <= n;j++) ns[i][j] = s[i][j] ? j : ns[i][j-1]; 
	}
	for (int L = 1;L <= n;L++) {
		for (int l = 1, r = L;r <= n;l++, r++) {
			sol(l, r); 
		}
	}
	int ans = 0; 
	for (int i = 0;i <= n;i++) {
//		ans += f[1][n][i]
		int k = 1; 
		for (int j = 0;j <= n;j++) {
			if (j == i) continue; 
			k = k*(c-j)%mod*qpow(i-j)%mod; 
		}
		(ans += f[1][n][i]*k) %= mod; 
	}
	if (ans < 0) ans += mod; 
	cout << ans; 
}

signed main () {
//	freopen("t.in", "r", stdin); 
//	ios::sync_with_stdio(0);
//	cin.tie(0); cout.tie(0);
	int T = 1; 
	while (T--) solve();
	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: 5788kb

input:

5 3 5
3 5
2 2
2 4

output:

45

result:

ok 1 number(s): "45"

Test #2:

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

input:

5 5 5
1 1
3 4
1 3
2 2
3 3

output:

375

result:

ok 1 number(s): "375"

Test #3:

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

input:

5 7 5
3 3
4 5
5 5
3 5
1 2
1 3
2 3

output:

675

result:

ok 1 number(s): "675"

Subtask #2:

score: 10
Accepted

Test #4:

score: 10
Accepted
time: 74ms
memory: 17664kb

input:

100 113 100
1 100
1 57
1 4
1 1
2 4
2 2
3 3
4 4
5 57
5 42
5 34
5 10
5 7
5 5
6 7
7 7
8 10
8 9
10 10
11 11
12 17
12 15
12 13
13 13
14 14
16 17
17 17
18 25
18 22
18 18
19 19
20 22
21 22
23 25
23 24
23 23
24 24
26 27
26 26
30 30
31 34
31 31
32 34
32 33
32 32
33 33
34 34
35 42
35 37
35 36
35 35
36 36
38 4...

output:

403048276

result:

ok 1 number(s): "403048276"

Test #5:

score: 10
Accepted
time: 68ms
memory: 15680kb

input:

100 100 100
1 100
1 22
1 15
1 13
1 1
2 2
3 3
4 11
4 5
5 5
6 6
7 10
10 10
11 11
12 12
13 13
14 14
15 15
17 17
18 18
19 21
19 19
20 20
21 21
22 22
23 81
23 25
23 24
23 23
24 24
27 28
29 33
29 29
30 33
31 31
32 32
33 33
34 34
35 37
37 37
38 38
39 39
41 42
41 41
44 46
45 46
47 51
47 47
48 48
49 49
50 50...

output:

132139592

result:

ok 1 number(s): "132139592"

Test #6:

score: 10
Accepted
time: 75ms
memory: 16228kb

input:

100 101 100
1 18
1 9
1 1
2 2
3 3
4 4
5 8
6 8
6 6
8 8
9 9
10 10
11 15
11 11
12 15
12 14
15 15
16 16
17 18
17 17
18 18
19 98
19 31
19 26
19 20
19 19
21 21
22 23
23 23
24 26
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 79
32 70
32 35
32 32
33 35
34 35
34 34
36 37
38 38
39 39
40 42
40 41
41 41
43 ...

output:

464027037

result:

ok 1 number(s): "464027037"

Subtask #3:

score: 15
Accepted

Test #7:

score: 15
Accepted
time: 1ms
memory: 7856kb

input:

18 18 2
11 13
1 18
4 18
10 15
16 17
6 16
13 15
6 11
8 16
10 16
8 12
7 18
2 16
7 9
9 15
1 2
2 15
1 17

output:

108

result:

ok 1 number(s): "108"

Test #8:

score: 15
Accepted
time: 1ms
memory: 7800kb

input:

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

output:

237

result:

ok 1 number(s): "237"

Test #9:

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

input:

20 18 2
6 11
8 15
8 16
2 5
6 8
8 9
9 16
7 16
3 18
12 20
7 8
6 18
1 20
9 11
1 11
3 12
1 19
4 19

output:

73

result:

ok 1 number(s): "73"

Test #10:

score: 15
Accepted
time: 1ms
memory: 8112kb

input:

25 18 2
18 25
16 18
8 10
10 16
7 13
14 15
15 18
12 15
11 20
6 8
12 25
19 19
13 24
2 19
10 21
7 11
16 23
2 17

output:

247

result:

ok 1 number(s): "247"

Subtask #4:

score: 20
Accepted

Test #11:

score: 20
Accepted
time: 89ms
memory: 16044kb

input:

100 1000 2
64 71
31 38
86 98
71 87
14 45
73 87
1 21
72 86
7 94
39 99
1 81
33 52
6 12
25 59
77 88
51 51
31 68
39 79
44 48
18 79
49 95
27 94
43 76
52 64
83 95
37 41
62 82
4 30
8 92
53 90
6 37
46 97
29 40
45 91
13 37
33 95
66 99
78 85
76 90
26 36
14 24
52 54
12 34
19 44
6 86
24 76
48 60
50 73
24 96
12 ...

output:

662120375

result:

ok 1 number(s): "662120375"

Test #12:

score: 20
Accepted
time: 98ms
memory: 14576kb

input:

100 2000 2
39 99
47 64
22 64
27 61
21 53
3 34
17 78
10 19
28 96
56 69
61 91
3 18
37 66
12 57
51 75
44 79
36 69
4 16
1 20
8 93
14 54
65 77
4 68
28 35
11 63
49 89
78 80
57 73
7 66
70 93
34 84
5 26
21 75
86 91
67 78
35 42
45 78
18 83
58 91
14 69
3 67
75 81
69 86
67 99
19 99
79 95
29 90
4 52
39 93
89 95...

output:

880460316

result:

ok 1 number(s): "880460316"

Test #13:

score: 20
Accepted
time: 100ms
memory: 14972kb

input:

100 3000 2
73 78
29 72
54 68
80 100
20 64
44 51
16 34
61 79
42 97
62 93
28 80
6 7
29 94
30 71
44 66
50 86
30 31
44 67
6 44
42 93
57 97
19 47
18 37
15 89
61 99
48 74
7 44
39 66
78 97
49 92
32 49
22 43
10 82
58 93
49 66
25 98
39 91
43 89
34 92
81 85
4 30
16 74
74 74
66 94
28 74
43 63
10 65
25 42
83 92...

output:

66154129

result:

ok 1 number(s): "66154129"

Test #14:

score: 20
Accepted
time: 105ms
memory: 14948kb

input:

100 4000 2
3 96
16 65
7 24
61 62
92 93
37 90
3 55
28 50
90 94
57 73
6 59
49 57
16 78
7 36
35 94
23 66
7 84
6 74
15 70
20 65
20 77
13 75
7 19
18 58
33 57
14 50
5 79
75 85
28 84
25 75
15 88
25 36
6 55
12 100
6 46
37 41
58 68
31 40
36 59
79 91
49 55
8 96
29 78
51 65
17 73
33 99
9 31
36 79
4 80
65 79
35...

output:

705337982

result:

ok 1 number(s): "705337982"

Test #15:

score: 20
Accepted
time: 98ms
memory: 13504kb

input:

100 5000 2
27 52
72 74
65 97
1 59
27 69
13 99
7 68
69 69
33 81
21 65
8 9
24 29
44 68
72 99
71 84
76 90
42 62
26 30
18 95
53 85
88 88
90 100
9 63
3 73
63 75
13 54
68 86
75 88
32 39
33 82
53 65
71 72
45 84
52 82
22 84
15 83
26 83
38 55
6 68
18 91
19 29
38 91
61 96
1 25
59 67
67 86
50 86
51 77
84 91
25...

output:

882499718

result:

ok 1 number(s): "882499718"

Subtask #5:

score: 15
Accepted

Test #16:

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

input:

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

output:

559982825

result:

ok 1 number(s): "559982825"

Test #17:

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

input:

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

output:

890653496

result:

ok 1 number(s): "890653496"

Test #18:

score: 15
Accepted
time: 4ms
memory: 7368kb

input:

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

output:

989245193

result:

ok 1 number(s): "989245193"

Test #19:

score: 15
Accepted
time: 4ms
memory: 7200kb

input:

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

output:

453955995

result:

ok 1 number(s): "453955995"

Test #20:

score: 15
Accepted
time: 4ms
memory: 7068kb

input:

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

output:

121026555

result:

ok 1 number(s): "121026555"

Subtask #6:

score: 15
Accepted

Test #21:

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

input:

100 1000 100
76 98
7 33
21 88
2 12
66 89
54 99
26 41
9 88
27 87
36 64
21 68
30 55
37 45
27 99
8 54
37 86
73 79
6 24
13 14
64 100
65 98
31 53
30 56
17 81
37 82
16 68
13 66
34 83
6 81
41 70
56 59
77 85
91 97
66 74
57 97
42 66
2 46
64 83
18 55
50 53
28 62
57 86
30 54
12 62
29 41
40 88
33 99
76 90
40 79...

output:

642244113

result:

ok 1 number(s): "642244113"

Test #22:

score: 15
Accepted
time: 94ms
memory: 16628kb

input:

100 2000 100
61 63
1 21
48 73
59 97
57 69
79 85
50 78
48 89
71 88
43 82
22 52
2 99
18 60
56 89
63 75
33 52
5 27
42 98
29 90
36 99
50 66
47 91
18 38
8 53
46 62
20 93
52 84
30 41
34 35
35 76
69 84
63 82
47 95
32 88
19 51
28 60
44 61
2 33
3 47
19 94
43 76
28 41
10 86
85 85
70 74
62 84
7 37
37 70
23 86
...

output:

509093695

result:

ok 1 number(s): "509093695"

Test #23:

score: 15
Accepted
time: 99ms
memory: 14712kb

input:

100 3000 100
26 89
22 88
22 78
25 25
52 58
73 81
36 46
56 65
11 51
30 93
72 99
57 60
21 33
24 70
74 87
9 62
4 40
69 86
40 80
58 79
62 69
61 89
84 91
43 52
24 39
42 93
78 95
31 55
56 84
27 83
81 84
4 43
30 56
67 67
37 61
54 64
60 73
90 90
93 98
10 36
20 90
73 92
58 94
35 73
72 82
33 95
37 88
24 84
24...

output:

107208188

result:

ok 1 number(s): "107208188"

Test #24:

score: 15
Accepted
time: 100ms
memory: 14780kb

input:

100 4000 100
12 57
37 61
82 97
41 92
48 75
72 82
25 53
23 44
47 60
51 70
17 86
5 17
29 44
32 36
44 78
18 97
44 65
11 95
21 46
68 85
29 73
49 82
12 99
22 26
19 25
29 77
14 71
17 82
4 12
37 46
50 80
57 86
55 77
27 29
7 35
26 92
40 60
2 6
65 82
52 73
16 51
7 86
87 87
22 40
42 98
43 72
13 92
16 76
11 69...

output:

336465864

result:

ok 1 number(s): "336465864"

Test #25:

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

input:

100 5000 100
86 89
20 48
11 85
12 81
16 97
41 62
11 88
52 77
12 60
40 83
10 69
31 54
40 77
6 90
12 34
6 30
12 71
21 50
90 97
43 79
65 99
45 93
5 87
48 82
92 95
53 99
27 70
2 77
23 56
33 80
36 87
25 59
45 90
77 93
9 9
38 84
6 47
60 91
17 29
81 96
67 91
46 90
32 73
33 39
7 12
32 64
70 93
44 80
19 39
1...

output:

799243851

result:

ok 1 number(s): "799243851"

Subtask #7:

score: 20
Accepted

Test #26:

score: 20
Accepted
time: 81ms
memory: 18196kb

input:

100 300 618692854
10 36
29 31
19 65
45 89
25 67
29 43
15 29
30 86
50 62
38 46
42 94
78 81
93 94
50 58
12 27
39 60
42 86
60 88
67 83
58 90
42 79
57 64
36 38
13 26
66 79
24 25
23 86
60 71
12 40
47 57
26 92
9 11
6 8
75 95
73 80
33 39
37 40
3 88
23 27
24 65
61 93
49 61
70 83
27 43
19 87
15 27
48 89
11 9...

output:

156061519

result:

ok 1 number(s): "156061519"

Test #27:

score: 20
Accepted
time: 89ms
memory: 17460kb

input:

100 600 787111829
17 20
6 83
59 95
33 96
22 52
67 70
55 57
15 51
71 90
30 62
72 88
7 12
42 52
44 81
19 48
2 47
15 52
33 77
25 100
31 35
36 57
14 95
67 81
19 44
38 84
19 34
22 73
24 41
75 80
32 75
61 69
56 66
41 50
34 66
15 72
79 82
2 73
67 67
76 100
62 85
29 75
82 88
47 76
29 89
42 96
28 31
46 92
88...

output:

562787141

result:

ok 1 number(s): "562787141"

Test #28:

score: 20
Accepted
time: 92ms
memory: 15996kb

input:

100 900 168823234
32 34
26 48
27 80
58 85
82 97
30 31
54 78
20 100
72 91
9 28
15 22
12 73
13 88
36 98
58 89
31 95
67 70
7 50
33 62
31 38
11 96
31 45
6 41
38 48
28 70
53 97
28 73
15 93
24 98
72 73
66 98
4 97
29 42
82 86
7 41
13 36
74 78
64 65
33 67
87 90
37 88
4 19
13 83
46 97
7 79
37 40
29 62
21 65
...

output:

413936883

result:

ok 1 number(s): "413936883"

Test #29:

score: 20
Accepted
time: 97ms
memory: 16108kb

input:

100 1200 844553817
42 62
1 50
20 23
34 53
8 100
16 87
49 58
56 70
49 64
47 88
10 20
85 91
1 68
42 69
67 76
5 88
29 46
8 50
49 85
5 17
10 29
29 62
8 33
29 80
38 61
38 54
56 87
28 80
46 100
56 98
41 58
32 63
19 83
14 60
80 81
16 77
53 84
42 63
11 18
13 60
34 52
8 71
52 67
55 76
1 91
65 67
17 89
73 84
...

output:

677239168

result:

ok 1 number(s): "677239168"

Test #30:

score: 20
Accepted
time: 97ms
memory: 15616kb

input:

100 1500 985007994
66 89
27 68
30 68
30 80
6 77
13 73
26 58
3 51
3 77
77 86
3 67
70 82
68 89
15 46
34 42
37 53
14 49
1 63
4 14
23 48
12 96
3 18
77 78
22 38
2 20
13 50
43 80
33 56
5 23
39 78
13 74
84 100
10 30
47 75
22 71
29 50
7 65
54 88
38 78
86 99
35 52
49 92
28 94
47 53
11 39
23 33
2 27
64 91
66 ...

output:

377274915

result:

ok 1 number(s): "377274915"

Test #31:

score: 20
Accepted
time: 94ms
memory: 16652kb

input:

100 1800 47942514
23 62
10 55
65 72
3 61
59 63
8 71
1 77
28 50
73 85
20 36
31 50
47 89
75 78
1 15
15 69
70 95
50 55
35 96
2 12
74 81
46 56
58 98
23 66
92 99
7 57
32 79
35 45
48 79
25 74
18 55
2 17
68 92
27 100
7 16
44 80
16 72
51 94
15 42
10 75
9 85
18 21
20 67
29 65
60 84
10 32
22 46
19 64
64 100
3...

output:

740465348

result:

ok 1 number(s): "740465348"

Test #32:

score: 20
Accepted
time: 92ms
memory: 15928kb

input:

100 2100 25724393
38 93
16 68
6 44
81 81
55 99
17 31
33 49
41 72
96 99
57 95
37 94
18 21
13 56
61 82
51 68
2 31
64 66
18 99
46 71
23 42
5 64
5 47
23 79
38 62
6 63
50 66
30 77
10 37
31 93
32 54
6 59
14 41
14 82
50 84
29 82
6 93
47 93
31 81
15 93
16 32
75 85
58 58
17 68
15 86
50 82
31 76
54 96
46 97
3...

output:

375506666

result:

ok 1 number(s): "375506666"

Test #33:

score: 20
Accepted
time: 88ms
memory: 17796kb

input:

100 2400 821261226
61 71
57 97
25 38
38 51
6 97
42 96
17 28
3 61
41 88
36 70
21 80
4 59
1 48
6 24
67 87
76 86
26 70
13 99
51 51
9 30
3 16
28 85
66 88
49 93
28 89
31 73
49 91
74 79
45 97
56 56
50 56
42 95
16 34
39 62
18 53
5 52
75 100
37 83
89 91
43 46
3 94
10 56
23 71
28 60
25 37
5 67
32 53
6 69
26 ...

output:

282313750

result:

ok 1 number(s): "282313750"

Test #34:

score: 20
Accepted
time: 97ms
memory: 15360kb

input:

100 2700 416934397
8 33
41 89
37 82
19 99
25 98
39 65
46 66
9 73
76 87
89 89
48 60
47 99
67 99
2 50
42 65
33 88
63 89
18 38
50 91
8 77
3 11
18 72
3 99
10 11
47 95
66 75
16 32
55 91
1 87
19 52
45 63
40 66
8 10
44 62
1 68
26 26
7 24
3 46
45 93
63 95
79 92
30 82
4 88
45 90
65 73
11 52
65 82
62 68
33 48...

output:

797097690

result:

ok 1 number(s): "797097690"

Test #35:

score: 20
Accepted
time: 95ms
memory: 14736kb

input:

100 3000 755906810
13 22
50 98
42 43
2 5
21 52
73 76
52 63
9 49
62 99
3 97
68 90
31 96
1 91
32 50
4 23
11 34
27 29
14 97
18 83
78 83
51 95
31 43
4 24
52 84
74 97
38 68
84 86
26 84
11 32
4 20
58 89
79 90
6 90
33 66
38 56
46 77
25 38
62 79
74 95
77 81
48 86
5 15
40 54
53 69
72 94
30 33
14 86
30 85
3 5...

output:

37456147

result:

ok 1 number(s): "37456147"

Test #36:

score: 20
Accepted
time: 96ms
memory: 13752kb

input:

100 3300 972350078
13 27
75 87
43 61
25 75
10 39
85 95
34 40
79 79
42 84
54 96
33 80
14 15
13 46
14 89
28 60
3 54
65 82
37 90
16 39
61 91
44 45
22 30
22 52
1 41
2 5
82 96
6 91
33 67
76 86
67 96
16 17
63 76
24 26
84 95
5 54
18 62
7 52
28 83
30 88
51 84
2 11
12 85
45 100
34 66
44 59
52 71
56 62
31 39
...

output:

757190970

result:

ok 1 number(s): "757190970"

Test #37:

score: 20
Accepted
time: 96ms
memory: 16572kb

input:

100 3600 973352991
15 92
23 63
56 86
88 98
76 85
66 69
22 75
32 66
18 59
87 89
31 73
27 58
73 73
31 96
84 98
45 74
29 49
35 39
12 33
3 92
7 21
63 77
49 100
29 70
17 90
53 94
10 43
17 65
12 68
41 51
88 88
14 27
48 82
17 100
6 28
16 88
6 52
1 93
24 90
26 45
20 92
73 81
2 66
36 91
42 72
17 97
22 65
32 ...

output:

901263490

result:

ok 1 number(s): "901263490"

Test #38:

score: 20
Accepted
time: 100ms
memory: 15208kb

input:

100 3900 214104815
33 52
8 49
2 9
11 19
94 96
97 97
25 25
36 68
46 89
58 91
61 91
14 36
32 83
46 74
1 74
3 99
14 32
43 99
22 67
18 42
25 62
58 67
15 37
27 77
4 23
18 94
37 98
22 33
42 77
5 93
3 44
35 40
93 98
16 56
35 53
2 37
65 76
12 50
87 91
47 57
10 82
71 100
20 22
32 90
11 100
32 66
53 92
2 30
9...

output:

165486926

result:

ok 1 number(s): "165486926"

Test #39:

score: 20
Accepted
time: 93ms
memory: 14876kb

input:

100 4200 903923470
41 95
83 99
11 81
42 43
71 71
27 90
21 94
46 55
14 65
1 98
24 90
13 40
31 55
3 61
16 37
16 31
43 66
16 39
6 6
12 27
53 84
3 72
13 20
19 36
81 86
3 14
14 92
27 39
42 58
5 97
64 72
83 95
61 94
5 10
43 71
84 88
76 88
33 35
37 98
73 87
39 46
44 79
13 64
36 45
23 71
71 77
16 78
27 73
2...

output:

529553506

result:

ok 1 number(s): "529553506"

Test #40:

score: 20
Accepted
time: 102ms
memory: 14712kb

input:

100 4500 409801326
49 84
27 99
33 82
30 55
4 78
44 54
11 19
91 100
11 85
21 78
28 58
28 69
9 60
29 76
58 72
29 91
49 78
33 87
47 88
8 89
46 51
30 79
37 55
25 43
52 91
18 56
24 96
3 50
36 44
47 71
29 78
76 98
18 84
6 47
2 16
25 62
15 31
10 39
8 60
40 63
4 33
17 41
53 71
28 73
68 98
32 66
1 18
25 65
3...

output:

473091148

result:

ok 1 number(s): "473091148"