#include <vector>
using namespace std;
bool are_connected(vector<int> A, vector<int> B);
vector<int> sol1(int N)
{
int a=0,b=1;
vector<int>ans,ans1;
ans.push_back(a);
while (b<N&&are_connected({a},{b}))
{
ans.push_back(b);
b++;
}
if (b<N)
ans1.push_back(b);
for (int i=b+1;i<N;i++)
{
if (are_connected({a},{i}))
ans.push_back(i);
else
ans1.push_back(i);
}
return (ans.size()>ans1.size()?ans:ans1);
}
vector<int> sol2(int N)
{
return {};
}
vector<int> sol3(int N)
{
vector<int>ans;
for (int i=0;i<N;i++)
ans.push_back(i);
return ans;
}
vector<int> longest_trip(int N, int D)
{
if (D==1)
return sol1(N);
if (D==2)
return sol2(N);
return sol3(N);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
6 ms |
344 KB |
Output is correct |
4 |
Correct |
5 ms |
344 KB |
Output is correct |
5 |
Correct |
5 ms |
344 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
5 ms |
344 KB |
Output is correct |
4 |
Correct |
5 ms |
344 KB |
Output is correct |
5 |
Correct |
5 ms |
344 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |