Submission #928387

# Submission time Handle Problem Language Result Execution time Memory
928387 2024-02-16T09:38:16 Z n1k Longest Trip (IOI23_longesttrip) C++17
0 / 100
0 ms 500 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> ans;
    for(int start = 0; start<N/2; start++){
        vector<int> path = {start};

        for(int i=1, j; i<N;i++){
            int cur = (start + i) % N;
            if(are_connected({path[path.size()-1]}, {cur})){
                path.push_back(cur);
            }
        }
        if(ans.size() < path.size()){
            ans = path;
        }
    }
    cout << "len: " << ans.size() << endl;
    return ans;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:37:22: warning: unused variable 'j' [-Wunused-variable]
   37 |         for(int i=1, j; i<N;i++){
      |                      ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Secret mismatch (possible tampering with the output).
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Secret mismatch (possible tampering with the output).
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 500 KB Secret mismatch (possible tampering with the output).
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Secret mismatch (possible tampering with the output).
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Secret mismatch (possible tampering with the output).
2 Halted 0 ms 0 KB -