# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
841488 | flashmt | Longest Trip (IOI23_longesttrip) | C++17 | 2 ms | 464 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "longesttrip.h"
using namespace std;
vector<int> longest_trip(int n, int d)
{
vector<vector<int>> a(n, vector<int>(n));
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
a[i][j] = a[j][i] = are_connected({i}, {j});
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
for (int k = 0; k < n; k++)
if (a[i][j] && a[j][k])
{
deque<int> q;
q.push_back(i);
q.push_back(j);
q.push_back(k);
for (int p = 0; p < n; p++)
if (p != i && p != j && p != k)
{
if (a[p][q.back()]) q.push_back(p);
else
{
assert(a[p][q.front()]);
q.push_front(p);
}
}
vector<int> ans;
while (!empty(q))
{
ans.push_back(q.front());
q.pop_front();
}
assert(size(ans) == n);
return ans;
}
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
if (a[i][j])
{
return {i, j};
}
assert(0);
return {};
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |