// incorrect/sol_birka0_pv_D1Half_rand.cpp
#include "longesttrip.h"
#include <algorithm>
#include <random>
using namespace std;
random_device rd;
mt19937 g(rd());
vector<int> longest_trip(int N, int /*D*/)
{
vector<int> t;
for (int i = 0; i < N; ++i)
{
t.push_back(i);
}
bool ok = false;
while (!ok)
{
shuffle(t.begin(), t.end(), g);
ok = true;
for (int i = 0; i + 1 < (N + 1) / 2; ++i)
{
if (!are_connected({t[i]}, {t[i + 1]}))
{
ok = false;
break;
}
}
}
return vector<int>(t.begin(), t.begin() + (N + 1) / 2);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
5 |
Correct |
3 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 |
5 ms |
208 KB |
Output is correct |
9 |
Correct |
6 ms |
208 KB |
Output is correct |
10 |
Correct |
4 ms |
208 KB |
Output is correct |
11 |
Correct |
6 ms |
208 KB |
Output is correct |
12 |
Correct |
4 ms |
208 KB |
Output is correct |
13 |
Correct |
6 ms |
208 KB |
Output is correct |
14 |
Correct |
7 ms |
208 KB |
Output is correct |
15 |
Correct |
17 ms |
208 KB |
Output is correct |
16 |
Correct |
55 ms |
208 KB |
Output is correct |
17 |
Correct |
156 ms |
260 KB |
Output is correct |
18 |
Correct |
983 ms |
208 KB |
Output is correct |
19 |
Incorrect |
414 ms |
208 KB |
too many calls |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |