QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#72327#5176. 多控制反转juju527100 ✓3ms3600kbC++141.6kb2023-01-15 14:42:352023-01-15 14:47:50

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-15 14:47:50]
  • 评测
  • 测评结果:100
  • 用时:3ms
  • 内存:3600kb
  • [2023-01-15 14:42:35]
  • 提交

answer

//Code by juju527.
#include<bits/stdc++.h>
typedef long long ll;
#define pii pair<int,int>
#define fi first
#define se second
#define vec vector<int>
#define eb emplace_back
using namespace std;
const int maxq=805;
int read(){
    int x=0,y=1;
    char ch=getchar();
    while(ch<48||ch>57){if(ch==45)y=-1;ch=getchar();}
    while(ch>=48&&ch<=57)x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
    return x*y;
}
int len;
struct opt{int op,x,y,z;}res[maxq];
void opt1(int x){res[++len]=(opt){1,x};return ;}
void opt2(int x,int y){res[++len]=(opt){2,x,y};return ;}
void opt3(int x,int y,int z){res[++len]=(opt){3,x,y,z};return ;}
void solve(vec x,int z,vec y){
	int n=x.size();
	if(n==1){opt2(x[0],z);return ;}
	if(n==2){opt3(x[0],x[1],z);return ;}
	opt3(x[n-1],y[n-3],z);
	for(int i=n-2;i>=2;i--)opt3(x[i],y[i-2],y[i-1]);
	opt3(x[0],x[1],y[0]);
	for(int i=2;i<=n-2;i++)opt3(x[i],y[i-2],y[i-1]);
	opt3(x[n-1],y[n-3],z);
	for(int i=n-2;i>=2;i--)opt3(x[i],y[i-2],y[i-1]);
	opt3(x[0],x[1],y[0]);
	for(int i=2;i<=n-2;i++)opt3(x[i],y[i-2],y[i-1]);
	return ;
}
int main(){
    int n,m,Q,T;
	n=read();m=read();Q=read();T=read();
	if(n==0){puts("1");puts("1 0");return 0;}
	if(n==1){puts("1");puts("2 0 1");return 0;}
	int lim=n/2;
	vec A,B;A.clear();B.clear();
	for(int i=0;i<lim;i++)A.eb(i);
	for(int i=lim;i<n;i++)B.eb(i);
	B.eb(n+1);
	solve(A,n+1,B);solve(B,n,A);
	solve(A,n+1,B);solve(B,n,A);
	printf("%d\n",len);
	for(int i=1;i<=len;i++){
		if(res[i].op==1)printf("1 %d\n",res[i].x);
		else if(res[i].op==2)printf("2 %d %d\n",res[i].x,res[i].y);
		else printf("3 %d %d %d\n",res[i].x,res[i].y,res[i].z);
	}
    return 0;
}

详细

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

0 2 1 1

output:

1
1 0

result:

ok OK.

Test #2:

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

input:

13 28 105 1

output:

80
3 5 9 14
3 4 8 9
3 3 7 8
3 2 6 7
3 0 1 6
3 2 6 7
3 3 7 8
3 4 8 9
3 5 9 14
3 4 8 9
3 3 7 8
3 2 6 7
3 0 1 6
3 2 6 7
3 3 7 8
3 4 8 9
3 14 5 13
3 12 4 5
3 11 3 4
3 10 2 3
3 9 1 2
3 8 0 1
3 6 7 0
3 8 0 1
3 9 1 2
3 10 2 3
3 11 3 4
3 12 4 5
3 14 5 13
3 12 4 5
3 11 3 4
3 10 2 3
3 9 1 2
3 8 0 1
3 6 7 0
3 ...

result:

ok OK.

Test #3:

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

input:

5 12 41 1

output:

18
3 0 1 6
3 6 1 5
3 4 0 1
3 2 3 0
3 4 0 1
3 6 1 5
3 4 0 1
3 2 3 0
3 4 0 1
3 0 1 6
3 6 1 5
3 4 0 1
3 2 3 0
3 4 0 1
3 6 1 5
3 4 0 1
3 2 3 0
3 4 0 1

result:

ok OK.

Test #4:

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

input:

20 42 161 1

output:

136
3 9 17 21
3 8 16 17
3 7 15 16
3 6 14 15
3 5 13 14
3 4 12 13
3 3 11 12
3 2 10 11
3 0 1 10
3 2 10 11
3 3 11 12
3 4 12 13
3 5 13 14
3 6 14 15
3 7 15 16
3 8 16 17
3 9 17 21
3 8 16 17
3 7 15 16
3 6 14 15
3 5 13 14
3 4 12 13
3 3 11 12
3 2 10 11
3 0 1 10
3 2 10 11
3 3 11 12
3 4 12 13
3 5 13 14
3 6 14 1...

result:

ok OK.

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #5:

score: 10
Accepted
time: 2ms
memory: 3600kb

input:

48 98 385 2

output:

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

result:

ok OK.

Test #6:

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

input:

41 84 329 2

output:

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

result:

ok OK.

Test #7:

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

input:

50 102 401 2

output:

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

result:

ok OK.

Subtask #3:

score: 10
Accepted

Dependency #2:

100%
Accepted

Test #8:

score: 10
Accepted
time: 1ms
memory: 3284kb

input:

0 2 1 3

output:

1
1 0

result:

ok OK.

Test #9:

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

input:

19 40 153 3

output:

128
3 8 15 20
3 7 14 15
3 6 13 14
3 5 12 13
3 4 11 12
3 3 10 11
3 2 9 10
3 0 1 9
3 2 9 10
3 3 10 11
3 4 11 12
3 5 12 13
3 6 13 14
3 7 14 15
3 8 15 20
3 7 14 15
3 6 13 14
3 5 12 13
3 4 11 12
3 3 10 11
3 2 9 10
3 0 1 9
3 2 9 10
3 3 10 11
3 4 11 12
3 5 12 13
3 6 13 14
3 7 14 15
3 20 8 19
3 18 7 8
3 17 ...

result:

ok OK.

Test #10:

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

input:

47 96 377 3

output:

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

result:

ok OK.

Test #11:

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

input:

25 52 201 3

output:

176
3 11 21 26
3 10 20 21
3 9 19 20
3 8 18 19
3 7 17 18
3 6 16 17
3 5 15 16
3 4 14 15
3 3 13 14
3 2 12 13
3 0 1 12
3 2 12 13
3 3 13 14
3 4 14 15
3 5 15 16
3 6 16 17
3 7 17 18
3 8 18 19
3 9 19 20
3 10 20 21
3 11 21 26
3 10 20 21
3 9 19 20
3 8 18 19
3 7 17 18
3 6 16 17
3 5 15 16
3 4 14 15
3 3 13 14
3 ...

result:

ok OK.

Test #12:

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

input:

50 102 401 3

output:

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

result:

ok OK.

Subtask #4:

score: 10
Accepted

Test #13:

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

input:

0 2 1 4

output:

1
1 0

result:

ok OK.

Test #14:

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

input:

18 20 325 4

output:

120
3 8 15 19
3 7 14 15
3 6 13 14
3 5 12 13
3 4 11 12
3 3 10 11
3 2 9 10
3 0 1 9
3 2 9 10
3 3 10 11
3 4 11 12
3 5 12 13
3 6 13 14
3 7 14 15
3 8 15 19
3 7 14 15
3 6 13 14
3 5 12 13
3 4 11 12
3 3 10 11
3 2 9 10
3 0 1 9
3 2 9 10
3 3 10 11
3 4 11 12
3 5 12 13
3 6 13 14
3 7 14 15
3 19 7 18
3 17 6 7
3 16 ...

result:

ok OK.

Test #15:

score: 0
Accepted
time: 3ms
memory: 3468kb

input:

14 16 197 4

output:

88
3 6 11 15
3 5 10 11
3 4 9 10
3 3 8 9
3 2 7 8
3 0 1 7
3 2 7 8
3 3 8 9
3 4 9 10
3 5 10 11
3 6 11 15
3 5 10 11
3 4 9 10
3 3 8 9
3 2 7 8
3 0 1 7
3 2 7 8
3 3 8 9
3 4 9 10
3 5 10 11
3 15 5 14
3 13 4 5
3 12 3 4
3 11 2 3
3 10 1 2
3 9 0 1
3 7 8 0
3 9 0 1
3 10 1 2
3 11 2 3
3 12 3 4
3 13 4 5
3 15 5 14
3 13 ...

result:

ok OK.

Test #16:

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

input:

20 22 401 4

output:

136
3 9 17 21
3 8 16 17
3 7 15 16
3 6 14 15
3 5 13 14
3 4 12 13
3 3 11 12
3 2 10 11
3 0 1 10
3 2 10 11
3 3 11 12
3 4 12 13
3 5 13 14
3 6 14 15
3 7 15 16
3 8 16 17
3 9 17 21
3 8 16 17
3 7 15 16
3 6 14 15
3 5 13 14
3 4 12 13
3 3 11 12
3 2 10 11
3 0 1 10
3 2 10 11
3 3 11 12
3 4 12 13
3 5 13 14
3 6 14 1...

result:

ok OK.

Subtask #5:

score: 20
Accepted

Dependency #4:

100%
Accepted

Test #17:

score: 20
Accepted
time: 2ms
memory: 3548kb

input:

18 20 325 5

output:

120
3 8 15 19
3 7 14 15
3 6 13 14
3 5 12 13
3 4 11 12
3 3 10 11
3 2 9 10
3 0 1 9
3 2 9 10
3 3 10 11
3 4 11 12
3 5 12 13
3 6 13 14
3 7 14 15
3 8 15 19
3 7 14 15
3 6 13 14
3 5 12 13
3 4 11 12
3 3 10 11
3 2 9 10
3 0 1 9
3 2 9 10
3 3 10 11
3 4 11 12
3 5 12 13
3 6 13 14
3 7 14 15
3 19 7 18
3 17 6 7
3 16 ...

result:

ok OK.

Test #18:

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

input:

17 19 290 5

output:

112
3 7 13 18
3 6 12 13
3 5 11 12
3 4 10 11
3 3 9 10
3 2 8 9
3 0 1 8
3 2 8 9
3 3 9 10
3 4 10 11
3 5 11 12
3 6 12 13
3 7 13 18
3 6 12 13
3 5 11 12
3 4 10 11
3 3 9 10
3 2 8 9
3 0 1 8
3 2 8 9
3 3 9 10
3 4 10 11
3 5 11 12
3 6 12 13
3 18 7 17
3 16 6 7
3 15 5 6
3 14 4 5
3 13 3 4
3 12 2 3
3 11 1 2
3 10 0 1...

result:

ok OK.

Test #19:

score: 0
Accepted
time: 3ms
memory: 3572kb

input:

20 22 401 5

output:

136
3 9 17 21
3 8 16 17
3 7 15 16
3 6 14 15
3 5 13 14
3 4 12 13
3 3 11 12
3 2 10 11
3 0 1 10
3 2 10 11
3 3 11 12
3 4 12 13
3 5 13 14
3 6 14 15
3 7 15 16
3 8 16 17
3 9 17 21
3 8 16 17
3 7 15 16
3 6 14 15
3 5 13 14
3 4 12 13
3 3 11 12
3 2 10 11
3 0 1 10
3 2 10 11
3 3 11 12
3 4 12 13
3 5 13 14
3 6 14 1...

result:

ok OK.

Subtask #6:

score: 10
Accepted

Test #20:

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

input:

14 16 393 6

output:

88
3 6 11 15
3 5 10 11
3 4 9 10
3 3 8 9
3 2 7 8
3 0 1 7
3 2 7 8
3 3 8 9
3 4 9 10
3 5 10 11
3 6 11 15
3 5 10 11
3 4 9 10
3 3 8 9
3 2 7 8
3 0 1 7
3 2 7 8
3 3 8 9
3 4 9 10
3 5 10 11
3 15 5 14
3 13 4 5
3 12 3 4
3 11 2 3
3 10 1 2
3 9 0 1
3 7 8 0
3 9 0 1
3 10 1 2
3 11 2 3
3 12 3 4
3 13 4 5
3 15 5 14
3 13 ...

result:

ok OK.

Test #21:

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

input:

39 41 1093 6

output:

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

result:

ok OK.

Test #22:

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

input:

0 2 1 6

output:

1
1 0

result:

ok OK.

Test #23:

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

input:

50 52 1401 6

output:

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

result:

ok OK.

Subtask #7:

score: 10
Accepted

Dependency #2:

100%
Accepted

Dependency #4:

100%
Accepted

Test #24:

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

input:

93 95 745 7

output:

720
3 45 89 94
3 44 88 89
3 43 87 88
3 42 86 87
3 41 85 86
3 40 84 85
3 39 83 84
3 38 82 83
3 37 81 82
3 36 80 81
3 35 79 80
3 34 78 79
3 33 77 78
3 32 76 77
3 31 75 76
3 30 74 75
3 29 73 74
3 28 72 73
3 27 71 72
3 26 70 71
3 25 69 70
3 24 68 69
3 23 67 68
3 22 66 67
3 21 65 66
3 20 64 65
3 19 63 64...

result:

ok OK.

Test #25:

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

input:

82 84 657 7

output:

632
3 40 79 83
3 39 78 79
3 38 77 78
3 37 76 77
3 36 75 76
3 35 74 75
3 34 73 74
3 33 72 73
3 32 71 72
3 31 70 71
3 30 69 70
3 29 68 69
3 28 67 68
3 27 66 67
3 26 65 66
3 25 64 65
3 24 63 64
3 23 62 63
3 22 61 62
3 21 60 61
3 20 59 60
3 19 58 59
3 18 57 58
3 17 56 57
3 16 55 56
3 15 54 55
3 14 53 54...

result:

ok OK.

Test #26:

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

input:

100 102 801 7

output:

776
3 49 97 101
3 48 96 97
3 47 95 96
3 46 94 95
3 45 93 94
3 44 92 93
3 43 91 92
3 42 90 91
3 41 89 90
3 40 88 89
3 39 87 88
3 38 86 87
3 37 85 86
3 36 84 85
3 35 83 84
3 34 82 83
3 33 81 82
3 32 80 81
3 31 79 80
3 30 78 79
3 29 77 78
3 28 76 77
3 27 75 76
3 26 74 75
3 25 73 74
3 24 72 73
3 23 71 7...

result:

ok OK.

Subtask #8:

score: 15
Accepted

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Test #27:

score: 15
Accepted
time: 2ms
memory: 3516kb

input:

94 96 753 8

output:

728
3 46 91 95
3 45 90 91
3 44 89 90
3 43 88 89
3 42 87 88
3 41 86 87
3 40 85 86
3 39 84 85
3 38 83 84
3 37 82 83
3 36 81 82
3 35 80 81
3 34 79 80
3 33 78 79
3 32 77 78
3 31 76 77
3 30 75 76
3 29 74 75
3 28 73 74
3 27 72 73
3 26 71 72
3 25 70 71
3 24 69 70
3 23 68 69
3 22 67 68
3 21 66 67
3 20 65 66...

result:

ok OK.

Test #28:

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

input:

70 72 561 8

output:

536
3 34 67 71
3 33 66 67
3 32 65 66
3 31 64 65
3 30 63 64
3 29 62 63
3 28 61 62
3 27 60 61
3 26 59 60
3 25 58 59
3 24 57 58
3 23 56 57
3 22 55 56
3 21 54 55
3 20 53 54
3 19 52 53
3 18 51 52
3 17 50 51
3 16 49 50
3 15 48 49
3 14 47 48
3 13 46 47
3 12 45 46
3 11 44 45
3 10 43 44
3 9 42 43
3 8 41 42
3...

result:

ok OK.

Test #29:

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

input:

100 102 801 8

output:

776
3 49 97 101
3 48 96 97
3 47 95 96
3 46 94 95
3 45 93 94
3 44 92 93
3 43 91 92
3 42 90 91
3 41 89 90
3 40 88 89
3 39 87 88
3 38 86 87
3 37 85 86
3 36 84 85
3 35 83 84
3 34 82 83
3 33 81 82
3 32 80 81
3 31 79 80
3 30 78 79
3 29 77 78
3 28 76 77
3 27 75 76
3 26 74 75
3 25 73 74
3 24 72 73
3 23 71 7...

result:

ok OK.

Extra Test:

score: 0
Extra Test Passed