#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> longest_trip(int N, int D)
{
if(D == 3) {
vector<int> ret;
for(int i = 0; i < N; ++i) ret.push_back(i);
return ret;
}
else {
vector<pair<int, int> > idp;
for(int i = 0; i < N; ++i) for(int j = i + 1; j < N; ++j) {
vector<int> a, b;
a.push_back(i); b.push_back(j);
if(!are_connected(a, b)) idp.push_back({i, j});
}
vector<int> chk(N, 0);
for(auto p : idp) chk[p.first] = chk[p.second] = 1;
vector<int> ret;
for(int i = 0; i < (int)idp.size(); ++i) ret.push_back(idp[i].first);
for(int i = 0; i < (int)idp.size(); ++i) ret.push_back(idp[i].second);
for(int i = 0; i < N; ++i) if(!chk[i]) ret.push_back(i);
return ret;
}
}
# |
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 |
3 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 |
1 ms |
596 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
20 ms |
344 KB |
Output is correct |
3 |
Correct |
143 ms |
344 KB |
Output is correct |
4 |
Correct |
351 ms |
344 KB |
Output is correct |
5 |
Correct |
783 ms |
344 KB |
Output is correct |
6 |
Incorrect |
1 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
21 ms |
344 KB |
Output is correct |
3 |
Correct |
137 ms |
344 KB |
Output is correct |
4 |
Correct |
367 ms |
344 KB |
Output is correct |
5 |
Correct |
781 ms |
408 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 |
10 ms |
596 KB |
Output is correct |
2 |
Correct |
18 ms |
344 KB |
Output is correct |
3 |
Partially correct |
133 ms |
344 KB |
Output is partially correct |
4 |
Partially correct |
366 ms |
344 KB |
Output is partially correct |
5 |
Partially correct |
790 ms |
412 KB |
Output is partially correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |