| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1332921 | nerrrmin | Longest Trip (IOI23_longesttrip) | C++20 | 1 ms | 344 KiB |
#include "longesttrip.h"
#define pb push_back
#include<bits/stdc++.h>
using namespace std;
const int maxn = 303;
int n, d;
vector < int > g[maxn];
vector < int > path;
int used[maxn];
void dfs(int beg, vector < int >&curr)
{
used[beg] = 1;
if(curr.size() > path.size())
path = curr;
for (auto nb: g[beg])
{
if(used[nb])continue;
curr.pb(nb);
dfs(nb, curr);
curr.pop_back();
}
}
std::vector<int> longest_trip(int N, int D)
{
n = N;
d = D;
for (int i = 0; i < n; ++ i)
g[i].clear();
for (int i = 0; i < n; ++ i)
{
for (int j = i+1; j < n; ++ j)
{
vector < int > from ,to;
from.pb(i);
to.pb(j);
if(are_connected(from, to))
{
g[i].pb(j);
g[j].pb(i);
}
}
}
for (int i = 0; i < n; ++ i)
{
path.pb(i);
/*for (int j = 0; j < n; ++ j)
used[j] = 0;
vector < int > curr;
dfs(0, curr);*/
}
return path;
}
| # | 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... | ||||
