#include "longesttrip.h"
#include <iostream>
#include <algorithm>
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;
vector<int> longest_trip(int N, int d)
{
bool chc[N]{};
vector<pii> V;
for(int i = 0; i < N; ++i)
{
for(int j = i + 1; j < N; ++j)
{
if(!are_connected(vector<int>{i}, vector<int>{j}))
chc[i] = true, chc[j] = true, V.push_back({i, j});
}
}
vector<int> ret;
for(auto [x, y] : V) ret.push_back(x);
for(int i = 0; i < N; ++i) if(!chc[i]) ret.push_back(i);
for(auto [x, y] : V) ret.push_back(y);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Correct |
22 ms |
344 KB |
Output is correct |
3 |
Correct |
121 ms |
344 KB |
Output is correct |
4 |
Correct |
367 ms |
344 KB |
Output is correct |
5 |
Correct |
763 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
344 KB |
Output is correct |
2 |
Correct |
22 ms |
344 KB |
Output is correct |
3 |
Correct |
114 ms |
344 KB |
Output is correct |
4 |
Correct |
333 ms |
344 KB |
Output is correct |
5 |
Correct |
711 ms |
408 KB |
Output is correct |
6 |
Correct |
7 ms |
344 KB |
Output is correct |
7 |
Correct |
23 ms |
344 KB |
Output is correct |
8 |
Correct |
132 ms |
344 KB |
Output is correct |
9 |
Correct |
247 ms |
344 KB |
Output is correct |
10 |
Correct |
737 ms |
408 KB |
Output is correct |
11 |
Correct |
752 ms |
408 KB |
Output is correct |
12 |
Correct |
708 ms |
412 KB |
Output is correct |
13 |
Correct |
751 ms |
412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Correct |
23 ms |
344 KB |
Output is correct |
3 |
Correct |
115 ms |
344 KB |
Output is correct |
4 |
Correct |
365 ms |
344 KB |
Output is correct |
5 |
Correct |
711 ms |
408 KB |
Output is correct |
6 |
Correct |
10 ms |
596 KB |
Output is correct |
7 |
Correct |
20 ms |
344 KB |
Output is correct |
8 |
Correct |
136 ms |
344 KB |
Output is correct |
9 |
Correct |
255 ms |
344 KB |
Output is correct |
10 |
Correct |
725 ms |
408 KB |
Output is correct |
11 |
Correct |
729 ms |
408 KB |
Output is correct |
12 |
Correct |
706 ms |
412 KB |
Output is correct |
13 |
Correct |
725 ms |
344 KB |
Output is correct |
14 |
Incorrect |
0 ms |
344 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
28 ms |
344 KB |
Output is correct |
3 |
Partially correct |
120 ms |
344 KB |
Output is partially correct |
4 |
Partially correct |
342 ms |
344 KB |
Output is partially correct |
5 |
Partially correct |
717 ms |
408 KB |
Output is partially correct |
6 |
Correct |
8 ms |
344 KB |
Output is correct |
7 |
Correct |
23 ms |
344 KB |
Output is correct |
8 |
Partially correct |
150 ms |
340 KB |
Output is partially correct |
9 |
Partially correct |
258 ms |
344 KB |
Output is partially correct |
10 |
Partially correct |
781 ms |
408 KB |
Output is partially correct |
11 |
Partially correct |
771 ms |
592 KB |
Output is partially correct |
12 |
Partially correct |
672 ms |
412 KB |
Output is partially correct |
13 |
Partially correct |
666 ms |
408 KB |
Output is partially correct |
14 |
Incorrect |
1 ms |
344 KB |
Incorrect |
15 |
Halted |
0 ms |
0 KB |
- |