QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#849785#9909. 阿尔塔尔 2guleng2007Compile Error//C++20403b2025-01-09 18:15:302025-01-09 18:15:39

Judging History

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

  • [2025-01-09 18:15:39]
  • 评测
  • [2025-01-09 18:15:30]
  • 提交

answer

#include <bits/stdc++.h>
#include "altar.h"
using namespace std;

void solve(vector <int> vec)
{
	int x=vec[rnd()%vec.size()];
	vector <int> newvec;
	for(auto y:vec)
		if(y!=x && sense(y,x))
			newvec.push_back(y);

	if(newvec.size()==0)
		return x;
	return solve(newvec);
}

int altar(int n)
{
	vector <int> vec;
	for(int i=1;i<=n;i++)
		vec.push_back(i);

	return solve(vec);
}

Details

answer.code: In function ‘void solve(std::vector<int>)’:
answer.code:7:19: error: ‘rnd’ was not declared in this scope; did you mean ‘rand’?
    7 |         int x=vec[rnd()%vec.size()];
      |                   ^~~
      |                   rand
answer.code:14:24: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
   14 |                 return x;
      |                        ^
answer.code: In function ‘int altar(int)’:
answer.code:24:21: error: void value not ignored as it ought to be
   24 |         return solve(vec);
      |                ~~~~~^~~~~