QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325628 | #7119. Longest Trip | flying | Compile Error | / | / | C++14 | 758b | 2024-02-11 18:12:00 | 2024-04-28 09:39:19 |
Judging History
你现在查看的是最新测评结果
- [2024-04-28 09:39:19]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-02-11 18:12:00]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [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 | } | ^