QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135658#5176. 多控制反转1kriCompile Error//C++14901b2023-08-05 20:33:512023-08-05 20:33:55

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:33:55]
  • 评测
  • [2023-08-05 20:33:51]
  • 提交

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,1);
	work(a-1,b+1);
	if (o==1)add(3,a,b+1,b,1);
	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;
}

详细

answer.code: In function ‘void work(int, int, int)’:
answer.code:21:21: error: too many arguments to function ‘void add(int, int, int, int)’
   21 |         if (o==1)add(3,a,b+1,b,1);
      |                  ~~~^~~~~~~~~~~~~
answer.code:7:6: note: declared here
    7 | void add(int a,int b,int c,int d){
      |      ^~~
answer.code:22:13: error: too few arguments to function ‘void work(int, int, int)’
   22 |         work(a-1,b+1);
      |         ~~~~^~~~~~~~~
answer.code:12:6: note: declared here
   12 | void work(int a,int b,int o){
      |      ^~~~
answer.code:23:21: error: too many arguments to function ‘void add(int, int, int, int)’
   23 |         if (o==1)add(3,a,b+1,b,1);
      |                  ~~~^~~~~~~~~~~~~
answer.code:7:6: note: declared here
    7 | void add(int a,int b,int c,int d){
      |      ^~~