Submission #928388

# Submission time Handle Problem Language Result Execution time Memory
928388 2024-02-16T09:38:56 Z n1k Longest Trip (IOI23_longesttrip) C++17
30 / 100
761 ms 600 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; 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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Incorrect 172 ms 356 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 21 ms 344 KB Output is correct
3 Correct 118 ms 344 KB Output is correct
4 Correct 364 ms 344 KB Output is correct
5 Correct 699 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 23 ms 344 KB Output is correct
3 Correct 120 ms 344 KB Output is correct
4 Correct 347 ms 344 KB Output is correct
5 Correct 703 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 21 ms 344 KB Output is correct
3 Correct 105 ms 344 KB Output is correct
4 Correct 349 ms 344 KB Output is correct
5 Correct 701 ms 600 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 27 ms 344 KB Output is correct
8 Correct 119 ms 344 KB Output is correct
9 Correct 281 ms 412 KB Output is correct
10 Correct 650 ms 344 KB Output is correct
11 Correct 648 ms 344 KB Output is correct
12 Correct 720 ms 344 KB Output is correct
13 Correct 666 ms 344 KB Output is correct
14 Correct 6 ms 344 KB Output is correct
15 Correct 8 ms 344 KB Output is correct
16 Correct 33 ms 344 KB Output is correct
17 Correct 88 ms 596 KB Output is correct
18 Correct 119 ms 344 KB Output is correct
19 Correct 282 ms 408 KB Output is correct
20 Correct 262 ms 600 KB Output is correct
21 Correct 715 ms 600 KB Output is correct
22 Correct 710 ms 600 KB Output is correct
23 Correct 686 ms 416 KB Output is correct
24 Correct 687 ms 416 KB Output is correct
25 Correct 9 ms 344 KB Output is correct
26 Correct 9 ms 344 KB Output is correct
27 Correct 22 ms 344 KB Output is correct
28 Correct 18 ms 344 KB Output is correct
29 Correct 18 ms 344 KB Output is correct
30 Correct 172 ms 344 KB Output is correct
31 Correct 162 ms 344 KB Output is correct
32 Correct 169 ms 344 KB Output is correct
33 Correct 245 ms 344 KB Output is correct
34 Correct 277 ms 344 KB Output is correct
35 Correct 270 ms 344 KB Output is correct
36 Correct 663 ms 600 KB Output is correct
37 Correct 681 ms 600 KB Output is correct
38 Correct 723 ms 600 KB Output is correct
39 Correct 714 ms 344 KB Output is correct
40 Correct 667 ms 344 KB Output is correct
41 Correct 680 ms 344 KB Output is correct
42 Correct 748 ms 344 KB Output is correct
43 Correct 702 ms 344 KB Output is correct
44 Correct 761 ms 600 KB Output is correct
45 Correct 8 ms 344 KB Output is correct
46 Correct 9 ms 344 KB Output is correct
47 Correct 24 ms 344 KB Output is correct
48 Correct 25 ms 344 KB Output is correct
49 Correct 20 ms 344 KB Output is correct
50 Correct 150 ms 344 KB Output is correct
51 Correct 185 ms 344 KB Output is correct
52 Correct 158 ms 344 KB Output is correct
53 Correct 261 ms 344 KB Output is correct
54 Correct 256 ms 344 KB Output is correct
55 Correct 256 ms 412 KB Output is correct
56 Correct 669 ms 596 KB Output is correct
57 Correct 696 ms 344 KB Output is correct
58 Correct 725 ms 600 KB Output is correct
59 Correct 696 ms 340 KB Output is correct
60 Correct 711 ms 600 KB Output is correct
61 Correct 707 ms 416 KB Output is correct
62 Correct 696 ms 408 KB Output is correct
63 Correct 711 ms 600 KB Output is correct
64 Correct 732 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 21 ms 344 KB Output is correct
3 Partially correct 123 ms 344 KB Output is partially correct
4 Partially correct 345 ms 340 KB Output is partially correct
5 Partially correct 737 ms 344 KB Output is partially correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -