# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928384 | n1k | Longest Trip (IOI23_longesttrip) | C++17 | 6 ms | 596 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
/*
D=3 N
all nodes have indegree N-1
D=2
OBSERVE:
Graph is connected
if 2 nodes are not connected all other nodes are connected to them
degree in N-1 or N-2
man kann immer zwischen 2er paaren huepfen
D=1
OBSERVE
if 2 nodes are not connected all other nodes are connected to either node
2 CC dann sind alle nodes in den CCs FC
alle nodes die nicht mit node u verbunden sind sind FC CHECK
INSIGHTS
seperate nodes in 2 things
alle nodes die nicht mit node u verbunden sind sind FC CHECK
*/
std::vector<int> longest_trip(int N, int D){
vector<int> path = {0}, rep(N);
vector<vector<int>> todo(N);
iota(rep.begin(), rep.end(), 0);
for(int i=1, j; i<N;i++){
if(are_connected({path[path.size()-1]}, {i})){
path.push_back(i);
}
}
//cout << "len: " << path.size() << endl;
return path;
}
Compilation message (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... |