QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135857#5176. 多控制反转1kri35 41ms3596kbC++142.0kb2023-08-06 10:57:422023-08-06 10:57:46

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-06 10:57:46]
  • 评测
  • 测评结果:35
  • 用时:41ms
  • 内存:3596kb
  • [2023-08-06 10:57:42]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int n,m,q,sub_id;
int tot,sta[1005][4];
int c[1005];
namespace Check{
	int a[105],_a[105];
	void work(){
		for (int i=0;i<(1<<(n+2));i++){
			if (i!=19)continue;
			for (int j=0;j<n+2;j++)a[j]=((i>>j)&1),_a[j]=a[j];
			for (int j=1;j<=tot;j++){
				if (sta[j][0]==1)a[sta[j][1]]^=1;
				if (sta[j][0]==2&&a[sta[j][1]]==1)a[sta[j][2]]^=1;
				if (sta[j][0]==3&&a[sta[j][1]]==1&&a[sta[j][2]]==1)a[sta[j][3]]^=1;
			}
			int o=1;
			for (int j=0;j<n;j++)
				if (a[j]==0)o=0;
			int fg=1;
			for (int j=0;j<n+2;j++){
				if (j==n){
					if (o==0&&a[j]!=_a[j])fg=0;
					if (o==1&&a[j]==_a[j])fg=0;
				}
				else if (a[j]!=_a[j])fg=0;
			}
			if (fg==0){
				cout<<"Wrong!"<<endl;
				for (int j=0;j<n+2;j++)cout<<a[j];cout<<endl;
				for (int j=0;j<n+2;j++)cout<<_a[j];cout<<endl; 
				return;
			}
		}
		return;
	}
}
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(vector<int> a,vector<int> b,int o){
	int la=(int)a.size(),lb=(int)b.size();
	if (la==0)return;
	if (la==1){
		add(2,a[0],b[0],-1);
		return;
	}
	if (la==2){
		add(3,a[0],a[1],b[0]);
		return;
	}
	if (o==1)add(3,a[0],b[1],b[0]);
	vector<int> _a,_b;
	for (int i=1;i<(int)a.size();i++)_a.push_back(a[i]),_b.push_back(b[i]);
	work(_a,_b,1);
	if (o==1)add(3,a[0],b[1],b[0]);
	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;
	}
	vector<int> a,b;
	for (int i=n-1;i>=0;i--)a.push_back(i),b.push_back(2*n-1-i);
	work(a,b,1);
	work(a,b,0);
	Check::work();
	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;
}

詳細信息

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

0 2 1 1

output:

1
1 0

result:

ok OK.

Test #2:

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

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 1 0 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: 3516kb

input:

5 12 41 1

output:

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

result:

ok OK.

Test #4:

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

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 1 0 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: 3596kb

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: 0ms
memory: 3512kb

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: 3ms
memory: 3496kb

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: 1ms
memory: 3456kb

input:

0 2 1 3

output:

1
1 0

result:

ok OK.

Test #9:

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

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 1 0 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: 0ms
memory: 3548kb

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: 41ms
memory: 3520kb

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 1 0 48 
3 2 48 47 
3 3 47 4...

result:

ok OK.

Test #12:

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

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: 3504kb

input:

0 2 1 4

output:

1
1 0

result:

ok OK.

Test #14:

score: -10
Wrong Answer
time: 0ms
memory: 3492kb

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 1 0 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: 3456kb

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 1 0 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%