QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#135659#5176. 多控制反转1kri35 3ms7520kbC++14899b2023-08-05 20:34:402023-08-05 20:34:42

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-05 20:34:42]
  • 评测
  • 测评结果:35
  • 用时:3ms
  • 内存:7520kb
  • [2023-08-05 20:34:40]
  • 提交

answer

#include <iostream>
#include <cstdio>
using namespace std;
int n,m,q,sub_id;
int tot,sta[1000005][4];
int c[1000005];
void add(int a,int b,int c,int d){
	++tot;
	sta[tot][0]=a,sta[tot][1]=b,sta[tot][2]=c,sta[tot][3]=d;
	return;
}
void work(int a,int b,int o){
	if (a==0){
		add(2,a,b,-1);
		return;
	}
	if (a==1){
		add(3,a-1,a,b);
		return;
	}
	if (o==1)add(3,a,b+1,b);
	work(a-1,b+1,1);
	if (o==1)add(3,a,b+1,b);
	return;
}
int main(){
	cin>>n>>m>>q>>sub_id;
	if (n==0){
		cout<<1<<endl;
		cout<<"1 0"<<endl;
		return 0;
	}
	if (n==1){
		cout<<1<<endl;
		cout<<"2 0 1"<<endl;
		return 0;
	}
	if (n==2){
		cout<<1<<endl;
		cout<<"3 0 1 2"<<endl;
		return 0;
	}
	work(n-1,n,1);
	work(n-1,n,0);
	cout<<tot<<endl;
	for (int i=1;i<=tot;i++){
		cout<<sta[i][0]<<' ';
		for (int j=1;j<=sta[i][0];j++)cout<<sta[i][j]<<' ';
		cout<<endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

0 2 1 1

output:

1
1 0

result:

ok OK.

Test #2:

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

input:

13 28 105 1

output:

44
3 12 14 13 
3 11 15 14 
3 10 16 15 
3 9 17 16 
3 8 18 17 
3 7 19 18 
3 6 20 19 
3 5 21 20 
3 4 22 21 
3 3 23 22 
3 2 24 23 
3 0 1 24 
3 2 24 23 
3 3 23 22 
3 4 22 21 
3 5 21 20 
3 6 20 19 
3 7 19 18 
3 8 18 17 
3 9 17 16 
3 10 16 15 
3 11 15 14 
3 12 14 13 
3 11 15 14 
3 10 16 15 
3 9 17 16 
3 8 ...

result:

ok OK.

Test #3:

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

input:

5 12 41 1

output:

12
3 4 6 5 
3 3 7 6 
3 2 8 7 
3 0 1 8 
3 2 8 7 
3 3 7 6 
3 4 6 5 
3 3 7 6 
3 2 8 7 
3 0 1 8 
3 2 8 7 
3 3 7 6 

result:

ok OK.

Test #4:

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

input:

20 42 161 1

output:

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

result:

ok OK.

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #5:

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

input:

48 98 385 2

output:

184
3 47 49 48 
3 46 50 49 
3 45 51 50 
3 44 52 51 
3 43 53 52 
3 42 54 53 
3 41 55 54 
3 40 56 55 
3 39 57 56 
3 38 58 57 
3 37 59 58 
3 36 60 59 
3 35 61 60 
3 34 62 61 
3 33 63 62 
3 32 64 63 
3 31 65 64 
3 30 66 65 
3 29 67 66 
3 28 68 67 
3 27 69 68 
3 26 70 69 
3 25 71 70 
3 24 72 71 
3 23 73 ...

result:

ok OK.

Test #6:

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

input:

41 84 329 2

output:

156
3 40 42 41 
3 39 43 42 
3 38 44 43 
3 37 45 44 
3 36 46 45 
3 35 47 46 
3 34 48 47 
3 33 49 48 
3 32 50 49 
3 31 51 50 
3 30 52 51 
3 29 53 52 
3 28 54 53 
3 27 55 54 
3 26 56 55 
3 25 57 56 
3 24 58 57 
3 23 59 58 
3 22 60 59 
3 21 61 60 
3 20 62 61 
3 19 63 62 
3 18 64 63 
3 17 65 64 
3 16 66 ...

result:

ok OK.

Test #7:

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

input:

50 102 401 2

output:

192
3 49 51 50 
3 48 52 51 
3 47 53 52 
3 46 54 53 
3 45 55 54 
3 44 56 55 
3 43 57 56 
3 42 58 57 
3 41 59 58 
3 40 60 59 
3 39 61 60 
3 38 62 61 
3 37 63 62 
3 36 64 63 
3 35 65 64 
3 34 66 65 
3 33 67 66 
3 32 68 67 
3 31 69 68 
3 30 70 69 
3 29 71 70 
3 28 72 71 
3 27 73 72 
3 26 74 73 
3 25 75 ...

result:

ok OK.

Subtask #3:

score: 10
Accepted

Dependency #2:

100%
Accepted

Test #8:

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

input:

0 2 1 3

output:

1
1 0

result:

ok OK.

Test #9:

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

input:

19 40 153 3

output:

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

result:

ok OK.

Test #10:

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

input:

47 96 377 3

output:

180
3 46 48 47 
3 45 49 48 
3 44 50 49 
3 43 51 50 
3 42 52 51 
3 41 53 52 
3 40 54 53 
3 39 55 54 
3 38 56 55 
3 37 57 56 
3 36 58 57 
3 35 59 58 
3 34 60 59 
3 33 61 60 
3 32 62 61 
3 31 63 62 
3 30 64 63 
3 29 65 64 
3 28 66 65 
3 27 67 66 
3 26 68 67 
3 25 69 68 
3 24 70 69 
3 23 71 70 
3 22 72 ...

result:

ok OK.

Test #11:

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

input:

25 52 201 3

output:

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

result:

ok OK.

Test #12:

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

input:

50 102 401 3

output:

192
3 49 51 50 
3 48 52 51 
3 47 53 52 
3 46 54 53 
3 45 55 54 
3 44 56 55 
3 43 57 56 
3 42 58 57 
3 41 59 58 
3 40 60 59 
3 39 61 60 
3 38 62 61 
3 37 63 62 
3 36 64 63 
3 35 65 64 
3 34 66 65 
3 33 67 66 
3 32 68 67 
3 31 69 68 
3 30 70 69 
3 29 71 70 
3 28 72 71 
3 27 73 72 
3 26 74 73 
3 25 75 ...

result:

ok OK.

Subtask #4:

score: 0
Wrong Answer

Test #13:

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

input:

0 2 1 4

output:

1
1 0

result:

ok OK.

Test #14:

score: -10
Wrong Answer
time: 2ms
memory: 5676kb

input:

18 20 325 4

output:

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

result:

wrong answer Integer 20 violates the range [0, 19]

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Wrong Answer

Test #20:

score: 0
Wrong Answer
time: 2ms
memory: 5572kb

input:

14 16 393 6

output:

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

result:

wrong answer Integer 16 violates the range [0, 15]

Subtask #7:

score: 0
Skipped

Dependency #2:

100%
Accepted

Dependency #4:

0%

Subtask #8:

score: 0
Skipped

Dependency #3:

100%
Accepted

Dependency #5:

0%