QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#77982#3269. 末日魔法少女计划tricyzhkx100 ✓758ms6024kbC++141.8kb2023-02-16 11:27:562023-02-16 11:27:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-16 11:27:59]
  • 评测
  • 测评结果:100
  • 用时:758ms
  • 内存:6024kb
  • [2023-02-16 11:27:56]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int ans,f[16][2010],cnt[16][2010],blo[16][2010],typ[16][2010],A[2010][2010];
void add(int u,int v){printf("%d %d\n",u,v);ans++;}
void solve(vi S,int k)
{
	if((int)S.size()<=k+1) return;
	int n=S.size()-1;
	if(k==1)
	{
		for(int i=0;i<=n;i++)
			for(int j=i+2;j<=n;j++)
				add(S[i],S[j]);
		return;
	}
	if(k==2)
	{
		int m=n/2;
		for(int i=0;i<m-1;i++) add(S[i],S[m]);
		for(int i=n;i>m+1;i--) add(S[m],S[i]);
		solve(vi(S.begin(),S.begin()+m),k);solve(vi(S.begin()+m+1,S.end()),k);
		return;
	}
	int c=cnt[k][n],B=blo[k][n],t=typ[k][n],rest=n-c*B-t,L=rest/2,R=(rest+1)/2;
	for(int i=0;i<L-1;i++) add(S[i],S[L]);
	for(int i=0;i<R-1;i++) add(S[n-R],S[n-i]);
	solve(vi(S.begin(),S.begin()+L),k);
	solve(vi(S.end()-R,S.end()),k);
	for(int i=0;i<c;i++)
	{
		int len=(i<c-t?B:B+1);
		for(int j=1;j<len-1;j++) add(S[L+i*B+j],S[L+i*B+len]);
		for(int j=2;j<len;j++) add(S[L+i*B],S[L+i*B+j]);
		add(S[L+i*B],S[L+i*B+len]);
		solve(vi(S.begin()+L+i*B+1,S.begin()+L+i*B+len),k);
	}
	vi T;
	for(int i=0;i<c;i++) T.push_back(S[L+i*B]);
	T.push_back(S[L+c*B+t]);
	solve(T,k-2);
}
int main()
{
	int n,K;
	cin>>n>>K;
	for(int i=1;i<=n;i++) f[1][i]=(i-1)*i/2;
	for(int i=3;i<=n;i++) f[2][i]=f[2][i/2-1]+f[2][i-i/2-1]+i-2;
	for(int i=3;i<=K;i++) fill(f[i]+i+1,f[i]+n+1,1e9);
	for(int k=3;k<=K;k++)
		for(int i=k+1;i<=n;i++)
			for(int j=1;j<=i-2;j++)
				for(int l=2;j*l<=i-2;l++)for(int t=0;t<2 && j*l+t<=i-2;t++)
				{
					int rest=i-j*l-t,L=rest/2,R=(rest+1)/2,w;
					w=f[k-2][j]+(j-t)*(2*l-3+f[k][l-2])+t*(2*l-1+f[k][l-1])+f[k][L-1]+f[k][R-1]+rest-2;
					if(w<f[k][i]) f[k][i]=w,cnt[k][i]=j,blo[k][i]=l,typ[k][i]=t;
				}
	vi S(n+1);
	iota(S.begin(),S.end(),0);
	cout<<f[K][n]<<endl;
	solve(S,K);assert(ans==f[K][n]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 22
Accepted

Test #1:

score: 22
Accepted
time: 0ms
memory: 5692kb

input:

2000 2

output:

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

result:

ok 

Test #2:

score: 22
Accepted
time: 4ms
memory: 3648kb

input:

1999 2

output:

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

result:

ok 

Test #3:

score: 22
Accepted
time: 1ms
memory: 3744kb

input:

1992 2

output:

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

result:

ok 

Test #4:

score: 22
Accepted
time: 4ms
memory: 3616kb

input:

1973 2

output:

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

result:

ok 

Test #5:

score: 22
Accepted
time: 4ms
memory: 3744kb

input:

1936 2

output:

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

result:

ok 

Subtask #2:

score: 14
Accepted

Test #6:

score: 14
Accepted
time: 57ms
memory: 5724kb

input:

1936 3

output:

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

result:

ok 

Test #7:

score: 14
Accepted
time: 61ms
memory: 3656kb

input:

2000 3

output:

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

result:

ok 

Test #8:

score: 14
Accepted
time: 61ms
memory: 3600kb

input:

1999 3

output:

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

result:

ok 

Test #9:

score: 14
Accepted
time: 61ms
memory: 3784kb

input:

1992 3

output:

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

result:

ok 

Test #10:

score: 14
Accepted
time: 61ms
memory: 3656kb

input:

1973 3

output:

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

result:

ok 

Subtask #3:

score: 11
Accepted

Test #11:

score: 11
Accepted
time: 119ms
memory: 3800kb

input:

2000 4

output:

4792
0 40
1 40
2 40
3 40
4 40
5 40
6 40
7 40
8 40
9 40
10 40
11 40
12 40
13 40
14 40
15 40
16 40
17 40
18 40
19 40
20 40
21 40
22 40
23 40
24 40
25 40
26 40
27 40
28 40
29 40
30 40
31 40
32 40
33 40
34 40
35 40
36 40
37 40
38 40
1960 2000
1960 1999
1960 1998
1960 1997
1960 1996
1960 1995
1960 1994
1...

result:

ok 

Test #12:

score: 11
Accepted
time: 119ms
memory: 3704kb

input:

1999 4

output:

4789
0 39
1 39
2 39
3 39
4 39
5 39
6 39
7 39
8 39
9 39
10 39
11 39
12 39
13 39
14 39
15 39
16 39
17 39
18 39
19 39
20 39
21 39
22 39
23 39
24 39
25 39
26 39
27 39
28 39
29 39
30 39
31 39
32 39
33 39
34 39
35 39
36 39
37 39
1959 1999
1959 1998
1959 1997
1959 1996
1959 1995
1959 1994
1959 1993
1959 19...

result:

ok 

Test #13:

score: 11
Accepted
time: 117ms
memory: 3704kb

input:

1991 4

output:

4768
0 38
1 38
2 38
3 38
4 38
5 38
6 38
7 38
8 38
9 38
10 38
11 38
12 38
13 38
14 38
15 38
16 38
17 38
18 38
19 38
20 38
21 38
22 38
23 38
24 38
25 38
26 38
27 38
28 38
29 38
30 38
31 38
32 38
33 38
34 38
35 38
36 38
1952 1991
1952 1990
1952 1989
1952 1988
1952 1987
1952 1986
1952 1985
1952 1984
195...

result:

ok 

Test #14:

score: 11
Accepted
time: 112ms
memory: 3696kb

input:

1971 4

output:

4715
0 40
1 40
2 40
3 40
4 40
5 40
6 40
7 40
8 40
9 40
10 40
11 40
12 40
13 40
14 40
15 40
16 40
17 40
18 40
19 40
20 40
21 40
22 40
23 40
24 40
25 40
26 40
27 40
28 40
29 40
30 40
31 40
32 40
33 40
34 40
35 40
36 40
37 40
38 40
1930 1971
1930 1970
1930 1969
1930 1968
1930 1967
1930 1966
1930 1965
1...

result:

ok 

Test #15:

score: 11
Accepted
time: 111ms
memory: 3688kb

input:

1938 4

output:

4626
0 39
1 39
2 39
3 39
4 39
5 39
6 39
7 39
8 39
9 39
10 39
11 39
12 39
13 39
14 39
15 39
16 39
17 39
18 39
19 39
20 39
21 39
22 39
23 39
24 39
25 39
26 39
27 39
28 39
29 39
30 39
31 39
32 39
33 39
34 39
35 39
36 39
37 39
1899 1938
1899 1937
1899 1936
1899 1935
1899 1934
1899 1933
1899 1932
1899 19...

result:

ok 

Subtask #4:

score: 9
Accepted

Test #16:

score: 9
Accepted
time: 174ms
memory: 3716kb

input:

2000 5

output:

3922
0 34
1 34
2 34
3 34
4 34
5 34
6 34
7 34
8 34
9 34
10 34
11 34
12 34
13 34
14 34
15 34
16 34
17 34
18 34
19 34
20 34
21 34
22 34
23 34
24 34
25 34
26 34
27 34
28 34
29 34
30 34
31 34
32 34
1966 2000
1966 1999
1966 1998
1966 1997
1966 1996
1966 1995
1966 1994
1966 1993
1966 1992
1966 1991
1966 19...

result:

ok 

Test #17:

score: 9
Accepted
time: 174ms
memory: 3776kb

input:

1999 5

output:

3920
0 37
1 37
2 37
3 37
4 37
5 37
6 37
7 37
8 37
9 37
10 37
11 37
12 37
13 37
14 37
15 37
16 37
17 37
18 37
19 37
20 37
21 37
22 37
23 37
24 37
25 37
26 37
27 37
28 37
29 37
30 37
31 37
32 37
33 37
34 37
35 37
1962 1999
1962 1998
1962 1997
1962 1996
1962 1995
1962 1994
1962 1993
1962 1992
1962 1991...

result:

ok 

Test #18:

score: 9
Accepted
time: 169ms
memory: 3708kb

input:

1992 5

output:

3906
0 37
1 37
2 37
3 37
4 37
5 37
6 37
7 37
8 37
9 37
10 37
11 37
12 37
13 37
14 37
15 37
16 37
17 37
18 37
19 37
20 37
21 37
22 37
23 37
24 37
25 37
26 37
27 37
28 37
29 37
30 37
31 37
32 37
33 37
34 37
35 37
1955 1992
1955 1991
1955 1990
1955 1989
1955 1988
1955 1987
1955 1986
1955 1985
1955 1984...

result:

ok 

Test #19:

score: 9
Accepted
time: 170ms
memory: 3688kb

input:

1973 5

output:

3866
0 34
1 34
2 34
3 34
4 34
5 34
6 34
7 34
8 34
9 34
10 34
11 34
12 34
13 34
14 34
15 34
16 34
17 34
18 34
19 34
20 34
21 34
22 34
23 34
24 34
25 34
26 34
27 34
28 34
29 34
30 34
31 34
32 34
1938 1973
1938 1972
1938 1971
1938 1970
1938 1969
1938 1968
1938 1967
1938 1966
1938 1965
1938 1964
1938 19...

result:

ok 

Test #20:

score: 9
Accepted
time: 164ms
memory: 3716kb

input:

1936 5

output:

3792
0 37
1 37
2 37
3 37
4 37
5 37
6 37
7 37
8 37
9 37
10 37
11 37
12 37
13 37
14 37
15 37
16 37
17 37
18 37
19 37
20 37
21 37
22 37
23 37
24 37
25 37
26 37
27 37
28 37
29 37
30 37
31 37
32 37
33 37
34 37
35 37
1899 1936
1899 1935
1899 1934
1899 1933
1899 1932
1899 1931
1899 1930
1899 1929
1899 1928...

result:

ok 

Subtask #5:

score: 7
Accepted

Test #21:

score: 7
Accepted
time: 237ms
memory: 5700kb

input:

2000 6

output:

3213
0 7
1 7
2 7
3 7
4 7
5 7
1993 2000
1993 1999
1993 1998
1993 1997
1993 1996
1993 1995
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 7...

result:

ok 

Test #22:

score: 7
Accepted
time: 228ms
memory: 5736kb

input:

1997 6

output:

3208
0 7
1 7
2 7
3 7
4 7
5 7
1990 1997
1990 1996
1990 1995
1990 1994
1990 1993
1990 1992
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 7...

result:

ok 

Test #23:

score: 7
Accepted
time: 232ms
memory: 3816kb

input:

1989 6

output:

3194
0 7
1 7
2 7
3 7
4 7
5 7
1982 1989
1982 1988
1982 1987
1982 1986
1982 1985
1982 1984
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 7...

result:

ok 

Test #24:

score: 7
Accepted
time: 227ms
memory: 3756kb

input:

1972 6

output:

3164
0 7
1 7
2 7
3 7
4 7
5 7
1965 1972
1965 1971
1965 1970
1965 1969
1965 1968
1965 1967
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 7...

result:

ok 

Test #25:

score: 7
Accepted
time: 213ms
memory: 5696kb

input:

1933 6

output:

3096
0 7
1 7
2 7
3 7
4 7
5 7
1926 1933
1926 1932
1926 1931
1926 1930
1926 1929
1926 1928
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 7...

result:

ok 

Subtask #6:

score: 6
Accepted

Test #26:

score: 6
Accepted
time: 289ms
memory: 3788kb

input:

1999 7

output:

2901
0 8
1 8
2 8
3 8
4 8
5 8
6 8
1991 1999
1991 1998
1991 1997
1991 1996
1991 1995
1991 1994
1991 1993
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
...

result:

ok 

Test #27:

score: 6
Accepted
time: 284ms
memory: 3848kb

input:

1997 7

output:

2898
0 8
1 8
2 8
3 8
4 8
5 8
6 8
1989 1997
1989 1996
1989 1995
1989 1994
1989 1993
1989 1992
1989 1991
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
...

result:

ok 

Test #28:

score: 6
Accepted
time: 281ms
memory: 5836kb

input:

1987 7

output:

2883
0 8
1 8
2 8
3 8
4 8
5 8
6 8
1979 1987
1979 1986
1979 1985
1979 1984
1979 1983
1979 1982
1979 1981
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
...

result:

ok 

Test #29:

score: 6
Accepted
time: 279ms
memory: 3792kb

input:

1978 7

output:

2869
0 8
1 8
2 8
3 8
4 8
5 8
6 8
1970 1978
1970 1977
1970 1976
1970 1975
1970 1974
1970 1973
1970 1972
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
...

result:

ok 

Test #30:

score: 6
Accepted
time: 269ms
memory: 3900kb

input:

1931 7

output:

2799
0 8
1 8
2 8
3 8
4 8
5 8
6 8
1923 1931
1923 1930
1923 1929
1923 1928
1923 1927
1923 1926
1923 1925
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
...

result:

ok 

Subtask #7:

score: 5
Accepted

Test #31:

score: 5
Accepted
time: 347ms
memory: 3960kb

input:

1995 8

output:

2501
0 9
1 9
2 9
3 9
4 9
5 9
6 9
7 9
1986 1995
1986 1994
1986 1993
1986 1992
1986 1991
1986 1990
1986 1989
1986 1988
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 7...

result:

ok 

Test #32:

score: 5
Accepted
time: 347ms
memory: 3824kb

input:

1999 8

output:

2506
0 9
1 9
2 9
3 9
4 9
5 9
6 9
7 9
1990 1999
1990 1998
1990 1997
1990 1996
1990 1995
1990 1994
1990 1993
1990 1992
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 7...

result:

ok 

Test #33:

score: 5
Accepted
time: 338ms
memory: 3840kb

input:

1987 8

output:

2490
0 9
1 9
2 9
3 9
4 9
5 9
6 9
7 9
1978 1987
1978 1986
1978 1985
1978 1984
1978 1983
1978 1982
1978 1981
1978 1980
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 7...

result:

ok 

Test #34:

score: 5
Accepted
time: 341ms
memory: 3880kb

input:

1981 8

output:

2481
0 8
1 8
2 8
3 8
4 8
5 8
6 8
1972 1981
1972 1980
1972 1979
1972 1978
1972 1977
1972 1976
1972 1975
1972 1974
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70...

result:

ok 

Test #35:

score: 5
Accepted
time: 315ms
memory: 3812kb

input:

1923 8

output:

2405
0 9
1 9
2 9
3 9
4 9
5 9
6 9
7 9
1914 1923
1914 1922
1914 1921
1914 1920
1914 1919
1914 1918
1914 1917
1914 1916
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 7...

result:

ok 

Subtask #8:

score: 5
Accepted

Test #36:

score: 5
Accepted
time: 403ms
memory: 3912kb

input:

1997 9

output:

2392
0 10
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
1987 1997
1987 1996
1987 1995
1987 1994
1987 1993
1987 1992
1987 1991
1987 1990
1987 1989
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 6...

result:

ok 

Test #37:

score: 5
Accepted
time: 402ms
memory: 3856kb

input:

1998 9

output:

2393
0 10
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
1988 1998
1988 1997
1988 1996
1988 1995
1988 1994
1988 1993
1988 1992
1988 1991
1988 1990
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 6...

result:

ok 

Test #38:

score: 5
Accepted
time: 400ms
memory: 3964kb

input:

1990 9

output:

2383
0 10
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
1980 1990
1980 1989
1980 1988
1980 1987
1980 1986
1980 1985
1980 1984
1980 1983
1980 1982
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 6...

result:

ok 

Test #39:

score: 5
Accepted
time: 396ms
memory: 3988kb

input:

1975 9

output:

2364
0 9
1 9
2 9
3 9
4 9
5 9
6 9
7 9
1965 1975
1965 1974
1965 1973
1965 1972
1965 1971
1965 1970
1965 1969
1965 1968
1965 1967
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
...

result:

ok 

Test #40:

score: 5
Accepted
time: 378ms
memory: 3860kb

input:

1934 9

output:

2313
0 10
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
1924 1934
1924 1933
1924 1932
1924 1931
1924 1930
1924 1929
1924 1928
1924 1927
1924 1926
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 6...

result:

ok 

Subtask #9:

score: 4
Accepted

Test #41:

score: 4
Accepted
time: 457ms
memory: 3836kb

input:

1995 10

output:

2193
0 11
1 11
2 11
3 11
4 11
5 11
6 11
7 11
8 11
9 11
1984 1995
1984 1994
1984 1993
1984 1992
1984 1991
1984 1990
1984 1989
1984 1988
1984 1987
1984 1986
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
5...

result:

ok 

Test #42:

score: 4
Accepted
time: 461ms
memory: 5672kb

input:

1996 10

output:

2194
0 11
1 11
2 11
3 11
4 11
5 11
6 11
7 11
8 11
9 11
1985 1996
1985 1995
1985 1994
1985 1993
1985 1992
1985 1991
1985 1990
1985 1989
1985 1988
1985 1987
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
5...

result:

ok 

Test #43:

score: 4
Accepted
time: 449ms
memory: 3828kb

input:

1979 10

output:

2175
0 11
1 11
2 11
3 11
4 11
5 11
6 11
7 11
8 11
9 11
1968 1979
1968 1978
1968 1977
1968 1976
1968 1975
1968 1974
1968 1973
1968 1972
1968 1971
1968 1970
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
5...

result:

ok 

Test #44:

score: 4
Accepted
time: 449ms
memory: 3892kb

input:

1972 10

output:

2166
0 11
1 11
2 11
3 11
4 11
5 11
6 11
7 11
8 11
9 11
1961 1972
1961 1971
1961 1970
1961 1969
1961 1968
1961 1967
1961 1966
1961 1965
1961 1964
1961 1963
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
5...

result:

ok 

Test #45:

score: 4
Accepted
time: 435ms
memory: 3884kb

input:

1945 10

output:

2135
0 10
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
1934 1945
1934 1944
1934 1943
1934 1942
1934 1941
1934 1940
1934 1939
1934 1938
1934 1937
1934 1936
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
...

result:

ok 

Subtask #10:

score: 4
Accepted

Test #46:

score: 4
Accepted
time: 516ms
memory: 5824kb

input:

1993 11

output:

2133
0 12
1 12
2 12
3 12
4 12
5 12
6 12
7 12
8 12
9 12
10 12
1981 1993
1981 1992
1981 1991
1981 1990
1981 1989
1981 1988
1981 1987
1981 1986
1981 1985
1981 1984
1981 1983
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 ...

result:

ok 

Test #47:

score: 4
Accepted
time: 511ms
memory: 3976kb

input:

1994 11

output:

2134
0 12
1 12
2 12
3 12
4 12
5 12
6 12
7 12
8 12
9 12
10 12
1982 1994
1982 1993
1982 1992
1982 1991
1982 1990
1982 1989
1982 1988
1982 1987
1982 1986
1982 1985
1982 1984
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 ...

result:

ok 

Test #48:

score: 4
Accepted
time: 516ms
memory: 3904kb

input:

2000 11

output:

2140
0 12
1 12
2 12
3 12
4 12
5 12
6 12
7 12
8 12
9 12
10 12
1988 2000
1988 1999
1988 1998
1988 1997
1988 1996
1988 1995
1988 1994
1988 1993
1988 1992
1988 1991
1988 1990
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 ...

result:

ok 

Test #49:

score: 4
Accepted
time: 504ms
memory: 3912kb

input:

1972 11

output:

2109
0 12
1 12
2 12
3 12
4 12
5 12
6 12
7 12
8 12
9 12
10 12
1960 1972
1960 1971
1960 1970
1960 1969
1960 1968
1960 1967
1960 1966
1960 1965
1960 1964
1960 1963
1960 1962
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 ...

result:

ok 

Test #50:

score: 4
Accepted
time: 481ms
memory: 4044kb

input:

1944 11

output:

2077
0 12
1 12
2 12
3 12
4 12
5 12
6 12
7 12
8 12
9 12
10 12
1932 1944
1932 1943
1932 1942
1932 1941
1932 1940
1932 1939
1932 1938
1932 1937
1932 1936
1932 1935
1932 1934
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 ...

result:

ok 

Subtask #11:

score: 4
Accepted

Test #51:

score: 4
Accepted
time: 575ms
memory: 3944kb

input:

1999 12

output:

2067
0 13
1 13
2 13
3 13
4 13
5 13
6 13
7 13
8 13
9 13
10 13
11 13
1986 1999
1986 1998
1986 1997
1986 1996
1986 1995
1986 1994
1986 1993
1986 1992
1986 1991
1986 1990
1986 1989
1986 1988
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51...

result:

ok 

Test #52:

score: 4
Accepted
time: 569ms
memory: 5804kb

input:

2000 12

output:

2068
0 13
1 13
2 13
3 13
4 13
5 13
6 13
7 13
8 13
9 13
10 13
11 13
1987 2000
1987 1999
1987 1998
1987 1997
1987 1996
1987 1995
1987 1994
1987 1993
1987 1992
1987 1991
1987 1990
1987 1989
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51...

result:

ok 

Test #53:

score: 4
Accepted
time: 582ms
memory: 4064kb

input:

1989 12

output:

2056
0 12
1 12
2 12
3 12
4 12
5 12
6 12
7 12
8 12
9 12
10 12
1976 1989
1976 1988
1976 1987
1976 1986
1976 1985
1976 1984
1976 1983
1976 1982
1976 1981
1976 1980
1976 1979
1976 1978
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52...

result:

ok 

Test #54:

score: 4
Accepted
time: 575ms
memory: 5672kb

input:

1976 12

output:

2042
0 13
1 13
2 13
3 13
4 13
5 13
6 13
7 13
8 13
9 13
10 13
11 13
1963 1976
1963 1975
1963 1974
1963 1973
1963 1972
1963 1971
1963 1970
1963 1969
1963 1968
1963 1967
1963 1966
1963 1965
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51...

result:

ok 

Test #55:

score: 4
Accepted
time: 543ms
memory: 3956kb

input:

1949 12

output:

2013
0 12
1 12
2 12
3 12
4 12
5 12
6 12
7 12
8 12
9 12
10 12
1936 1949
1936 1948
1936 1947
1936 1946
1936 1945
1936 1944
1936 1943
1936 1942
1936 1941
1936 1940
1936 1939
1936 1938
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52...

result:

ok 

Subtask #12:

score: 3
Accepted

Test #56:

score: 3
Accepted
time: 630ms
memory: 4028kb

input:

1981 13

output:

2004
0 14
1 14
2 14
3 14
4 14
5 14
6 14
7 14
8 14
9 14
10 14
11 14
12 14
1967 1981
1967 1980
1967 1979
1967 1978
1967 1977
1967 1976
1967 1975
1967 1974
1967 1973
1967 1972
1967 1971
1967 1970
1967 1969
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
4...

result:

ok 

Test #57:

score: 3
Accepted
time: 619ms
memory: 3972kb

input:

1982 13

output:

2005
0 14
1 14
2 14
3 14
4 14
5 14
6 14
7 14
8 14
9 14
10 14
11 14
12 14
1968 1982
1968 1981
1968 1980
1968 1979
1968 1978
1968 1977
1968 1976
1968 1975
1968 1974
1968 1973
1968 1972
1968 1971
1968 1970
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
4...

result:

ok 

Test #58:

score: 3
Accepted
time: 619ms
memory: 5888kb

input:

1989 13

output:

2012
0 13
1 13
2 13
3 13
4 13
5 13
6 13
7 13
8 13
9 13
10 13
11 13
1975 1989
1975 1988
1975 1987
1975 1986
1975 1985
1975 1984
1975 1983
1975 1982
1975 1981
1975 1980
1975 1979
1975 1978
1975 1977
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
4...

result:

ok 

Test #59:

score: 3
Accepted
time: 608ms
memory: 4036kb

input:

1972 13

output:

1994
0 14
1 14
2 14
3 14
4 14
5 14
6 14
7 14
8 14
9 14
10 14
11 14
12 14
1958 1972
1958 1971
1958 1970
1958 1969
1958 1968
1958 1967
1958 1966
1958 1965
1958 1964
1958 1963
1958 1962
1958 1961
1958 1960
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
4...

result:

ok 

Test #60:

score: 3
Accepted
time: 586ms
memory: 3924kb

input:

1929 13

output:

1949
0 13
1 13
2 13
3 13
4 13
5 13
6 13
7 13
8 13
9 13
10 13
11 13
1915 1929
1915 1928
1915 1927
1915 1926
1915 1925
1915 1924
1915 1923
1915 1922
1915 1921
1915 1920
1915 1919
1915 1918
1915 1917
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
4...

result:

ok 

Subtask #13:

score: 3
Accepted

Test #61:

score: 3
Accepted
time: 675ms
memory: 4140kb

input:

1979 14

output:

1981
0 15
1 15
2 15
3 15
4 15
5 15
6 15
7 15
8 15
9 15
10 15
11 15
12 15
13 15
1964 1979
1964 1978
1964 1977
1964 1976
1964 1975
1964 1974
1964 1973
1964 1972
1964 1971
1964 1970
1964 1969
1964 1968
1964 1967
1964 1966
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 ...

result:

ok 

Test #62:

score: 3
Accepted
time: 674ms
memory: 4116kb

input:

1980 14

output:

1982
0 15
1 15
2 15
3 15
4 15
5 15
6 15
7 15
8 15
9 15
10 15
11 15
12 15
13 15
1965 1980
1965 1979
1965 1978
1965 1977
1965 1976
1965 1975
1965 1974
1965 1973
1965 1972
1965 1971
1965 1970
1965 1969
1965 1968
1965 1967
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 ...

result:

ok 

Test #63:

score: 3
Accepted
time: 680ms
memory: 5908kb

input:

1987 14

output:

1989
0 14
1 14
2 14
3 14
4 14
5 14
6 14
7 14
8 14
9 14
10 14
11 14
12 14
1972 1987
1972 1986
1972 1985
1972 1984
1972 1983
1972 1982
1972 1981
1972 1980
1972 1979
1972 1978
1972 1977
1972 1976
1972 1975
1972 1974
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 ...

result:

ok 

Test #64:

score: 3
Accepted
time: 655ms
memory: 5828kb

input:

1952 14

output:

1953
0 15
1 15
2 15
3 15
4 15
5 15
6 15
7 15
8 15
9 15
10 15
11 15
12 15
13 15
1937 1952
1937 1951
1937 1950
1937 1949
1937 1948
1937 1947
1937 1946
1937 1945
1937 1944
1937 1943
1937 1942
1937 1941
1937 1940
1937 1939
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 ...

result:

ok 

Test #65:

score: 3
Accepted
time: 672ms
memory: 4044kb

input:

1936 14

output:

1936
0 15
1 15
2 15
3 15
4 15
5 15
6 15
7 15
8 15
9 15
10 15
11 15
12 15
13 15
1921 1936
1921 1935
1921 1934
1921 1933
1921 1932
1921 1931
1921 1930
1921 1929
1921 1928
1921 1927
1921 1926
1921 1925
1921 1924
1921 1923
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 ...

result:

ok 

Subtask #14:

score: 3
Accepted

Test #66:

score: 3
Accepted
time: 758ms
memory: 6024kb

input:

2000 15

output:

1988
0 16
1 16
2 16
3 16
4 16
5 16
6 16
7 16
8 16
9 16
10 16
11 16
12 16
13 16
14 16
1984 2000
1984 1999
1984 1998
1984 1997
1984 1996
1984 1995
1984 1994
1984 1993
1984 1992
1984 1991
1984 1990
1984 1989
1984 1988
1984 1987
1984 1986
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38...

result:

ok 

Test #67:

score: 3
Accepted
time: 740ms
memory: 4092kb

input:

1999 15

output:

1987
0 15
1 15
2 15
3 15
4 15
5 15
6 15
7 15
8 15
9 15
10 15
11 15
12 15
13 15
1983 1999
1983 1998
1983 1997
1983 1996
1983 1995
1983 1994
1983 1993
1983 1992
1983 1991
1983 1990
1983 1989
1983 1988
1983 1987
1983 1986
1983 1985
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39...

result:

ok 

Test #68:

score: 3
Accepted
time: 756ms
memory: 4036kb

input:

1992 15

output:

1980
0 16
1 16
2 16
3 16
4 16
5 16
6 16
7 16
8 16
9 16
10 16
11 16
12 16
13 16
14 16
1976 1992
1976 1991
1976 1990
1976 1989
1976 1988
1976 1987
1976 1986
1976 1985
1976 1984
1976 1983
1976 1982
1976 1981
1976 1980
1976 1979
1976 1978
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38...

result:

ok 

Test #69:

score: 3
Accepted
time: 746ms
memory: 4172kb

input:

1973 15

output:

1961
0 15
1 15
2 15
3 15
4 15
5 15
6 15
7 15
8 15
9 15
10 15
11 15
12 15
13 15
1957 1973
1957 1972
1957 1971
1957 1970
1957 1969
1957 1968
1957 1967
1957 1966
1957 1965
1957 1964
1957 1963
1957 1962
1957 1961
1957 1960
1957 1959
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39...

result:

ok 

Test #70:

score: 3
Accepted
time: 730ms
memory: 5976kb

input:

1936 15

output:

1923
0 16
1 16
2 16
3 16
4 16
5 16
6 16
7 16
8 16
9 16
10 16
11 16
12 16
13 16
14 16
1920 1936
1920 1935
1920 1934
1920 1933
1920 1932
1920 1931
1920 1930
1920 1929
1920 1928
1920 1927
1920 1926
1920 1925
1920 1924
1920 1923
1920 1922
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38...

result:

ok