Submission #1081162

# Submission time Handle Problem Language Result Execution time Memory
1081162 2024-08-29T18:59:11 Z MODDI Longest Trip (IOI23_longesttrip) C++17
0 / 100
40 ms 848 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define vi vector<int>
vector<int> G[257];
vector<int> best;
vector<bool> vis;
void dfs(int at, vector<int> path){
    vis[at] = true;
    path.pb(at);
    if(best.size() < path.size()){
        best = path;
    }
    for(auto next : G[at]){
        if(!vis[next]){
            dfs(next, path);
        }
    }
}
vector<int> longest_trip(int N, int D)
{
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            if(are_connected({i},{j})){
                G[i].pb(j);
                G[j].pb(i);
            }
        }
    }
    for(int i = 0; i < N; i++){
        vis.assign(N, false);
        dfs(i, {});
    }
    return best;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 344 KB Output is correct
2 Incorrect 26 ms 484 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Output is correct
2 Incorrect 31 ms 728 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 456 KB Output is correct
2 Incorrect 40 ms 848 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 600 KB Output is correct
2 Incorrect 28 ms 340 KB Incorrect
3 Halted 0 ms 0 KB -