Submission #928384

# Submission time Handle Problem Language Result Execution time Memory
928384 2024-02-16T09:31:39 Z n1k Longest Trip (IOI23_longesttrip) C++17
5 / 100
6 ms 596 KB
#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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:37:18: warning: unused variable 'j' [-Wunused-variable]
   37 |     for(int i=1, j; i<N;i++){
      |                  ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Incorrect 1 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 5 ms 344 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 5 ms 596 KB Output is correct
15 Incorrect 1 ms 348 KB Incorrect
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 528 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -