#include <bits/stdc++.h>
#include "longesttrip.h"
using namespace std;
using ll = long long;
int n, d;
bool adj[256][256];
vector<int> longest_trip(int N, int D) {
n = N;
d = D;
memset(adj, 0, sizeof adj);
for (int i = 0;i < n;i++) {
for (int j = i + 1;j < n;j++) {
adj[i][j] = adj[j][i] = are_connected({ i }, { j });
}
}
queue<int> q;
for (int i = 1;i < n;i++) {
q.push(i);
}
deque<int> ans;
ans.push_back(0);
while (!q.empty()) {
if (adj[ans.back()][q.front()]) {
ans.push_back(q.front());
q.pop();
}
else {
ans.push_front(q.front());
q.pop();
}
}
vector<int> Ans;
while (!ans.empty()) Ans.push_back(ans.front()), ans.pop_front();
return Ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
344 KB |
Output is correct |
2 |
Correct |
20 ms |
344 KB |
Output is correct |
3 |
Correct |
121 ms |
344 KB |
Output is correct |
4 |
Correct |
355 ms |
476 KB |
Output is correct |
5 |
Correct |
764 ms |
476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
344 KB |
Output is correct |
2 |
Correct |
27 ms |
344 KB |
Output is correct |
3 |
Correct |
116 ms |
344 KB |
Output is correct |
4 |
Correct |
388 ms |
592 KB |
Output is correct |
5 |
Correct |
711 ms |
472 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
21 ms |
344 KB |
Output is correct |
3 |
Correct |
119 ms |
344 KB |
Output is correct |
4 |
Correct |
337 ms |
476 KB |
Output is correct |
5 |
Correct |
689 ms |
476 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
22 ms |
344 KB |
Output is correct |
3 |
Partially correct |
115 ms |
344 KB |
Output is partially correct |
4 |
Partially correct |
350 ms |
480 KB |
Output is partially correct |
5 |
Partially correct |
724 ms |
476 KB |
Output is partially correct |
6 |
Incorrect |
1 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |