QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#823114#9909. 阿尔塔尔 2tanxiCompile Error//C++14751b2024-12-20 19:28:222024-12-20 19:28:23

Judging History

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

  • [2024-12-20 19:28:23]
  • 评测
  • [2024-12-20 19:28:22]
  • 提交

answer

#include "altar.h"
#include<bits/stdc++.h>
using namespace std;
const int N=309;
int v[N],vis[N];
int d[N][N];
mt19937 rd(time(0));
bool get(int x,int y)
{
	if(d[x][y]!=-1)
	return d[x][y];
	d[x][y]=sense(x,y);
	d[y][x]=d[x][y]^1;
}
int altar(int n)
{
	memset(d,-1,sizeof(d));
	memset(v,0,sizeof(v));
	memset(vis,0,sizeof(vis));
	int num=n,now=n;
	while(num>1)
	{
		int x=rd()%now+1;
		int p=0;
		for(int i=1;i<=n;i++)
		{
			if(v[i]||vis[i])
			continue;
			x--;
			if(!x)
			{
				p=i;
				break;
			}
		}
		for(int i=1;i<=n;i++)
		{
			if(!v[i])
			{
				v[i]=get(i,j);
				num-=v[i];
				if(!vis[i]&&v[i])
				now--;
			}
		}
		vis[p]=1;
		now--;
	}
	for(int i=1;i<=n;i++)
	if(!v[i])
	return i;
}

Details

answer.code: In function ‘int altar(int)’:
answer.code:40:44: error: ‘j’ was not declared in this scope
   40 |                                 v[i]=get(i,j);
      |                                            ^
answer.code: In function ‘bool get(int, int)’:
answer.code:13:16: warning: control reaches end of non-void function [-Wreturn-type]
   13 |         d[y][x]=d[x][y]^1;
      |         ~~~~~~~^~~~~~~~~~
answer.code: In function ‘int altar(int)’:
answer.code:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^