QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325628#7119. Longest TripflyingCompile Error//C++14758b2024-02-11 18:12:002024-04-28 09:39:19

Judging History

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

  • [2024-04-28 09:39:19]
  • 管理员手动重测本题所有提交记录
  • [2024-02-11 18:12:00]
  • 评测
  • [2024-02-11 18:12:00]
  • 提交

answer

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

bool check(int x,int y)
{
	vector <int> a;
	a.push_back(x);
	vector <int> b;
	b.push_back(y);
	return are_connected(a,b);
}

vector<int> longest_trip(int N, int D)
{
	if(D==3)
	{
		vector <int> ans;
		for(int i=0;i<N;i++)
			ans.push_back(i);
		return ans;
	}

	if(D==2)
	{
		vector <int> ans;
		if(check(0,1) && check(1,2))
			ans.push_back(0), ans.push_back(1), ans.push_back(2);
		else if(check(0,2) && check(2,1))
			ans.push_back(0), ans.push_back(2), ans.push_back(1);
		else
			ans.push_back(1), ans.push_back(0), ans.push_back(2);

		for(int i=3;i<N;i++)
			if(check(i,ans[0]))
				ans.insert(ans.begin(),i);
			else
				ans.insert(ans.end(),i);
		return ans;
	}
}

詳細信息

answer.code: In function ‘bool check(int, int)’:
answer.code:10:16: error: ‘are_connected’ was not declared in this scope
   10 |         return are_connected(a,b);
      |                ^~~~~~~~~~~~~
answer.code: In function ‘std::vector<int> longest_trip(int, int)’:
answer.code:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^