// incorrect/sol_na_D2.cpp
#include "longesttrip.h"
#include <deque>
std::vector<int> longest_trip(int N, int D)
{
std::deque<int> res;
int nxt;
if (are_connected({0}, {1}))
{
res = {0, 1};
nxt = 2;
}
else
{
res = {0, 2, 1};
nxt = 3;
}
while (nxt < N)
{
std::vector<int> A = {res.back()}, B = {nxt};
if (are_connected(A, B))
{
res.push_back(nxt);
}
else
{
res.push_front(nxt);
}
nxt++;
}
std::vector<int> ans;
for (auto i : res)
ans.push_back(i);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
6 ms |
208 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
208 KB |
Output is correct |
2 |
Correct |
9 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
5 ms |
288 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
5 ms |
208 KB |
Output is correct |
7 |
Correct |
5 ms |
208 KB |
Output is correct |
8 |
Correct |
8 ms |
208 KB |
Output is correct |
9 |
Correct |
7 ms |
208 KB |
Output is correct |
10 |
Correct |
9 ms |
292 KB |
Output is correct |
11 |
Correct |
9 ms |
208 KB |
Output is correct |
12 |
Correct |
9 ms |
208 KB |
Output is correct |
13 |
Correct |
10 ms |
284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
208 KB |
Output is correct |
4 |
Correct |
7 ms |
208 KB |
Output is correct |
5 |
Correct |
9 ms |
208 KB |
Output is correct |
6 |
Correct |
5 ms |
208 KB |
Output is correct |
7 |
Correct |
6 ms |
208 KB |
Output is correct |
8 |
Correct |
9 ms |
208 KB |
Output is correct |
9 |
Correct |
8 ms |
208 KB |
Output is correct |
10 |
Correct |
7 ms |
208 KB |
Output is correct |
11 |
Correct |
6 ms |
208 KB |
Output is correct |
12 |
Correct |
9 ms |
208 KB |
Output is correct |
13 |
Correct |
6 ms |
208 KB |
Output is correct |
14 |
Incorrect |
0 ms |
208 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
208 KB |
Output is correct |
2 |
Correct |
10 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
9 ms |
208 KB |
Output is correct |
5 |
Correct |
6 ms |
208 KB |
Output is correct |
6 |
Correct |
8 ms |
208 KB |
Output is correct |
7 |
Correct |
10 ms |
208 KB |
Output is correct |
8 |
Correct |
9 ms |
208 KB |
Output is correct |
9 |
Correct |
9 ms |
208 KB |
Output is correct |
10 |
Correct |
8 ms |
208 KB |
Output is correct |
11 |
Correct |
9 ms |
208 KB |
Output is correct |
12 |
Correct |
7 ms |
256 KB |
Output is correct |
13 |
Correct |
5 ms |
296 KB |
Output is correct |
14 |
Incorrect |
0 ms |
208 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |