Submission #1046122

# Submission time Handle Problem Language Result Execution time Memory
1046122 2024-08-06T10:19:12 Z ezzzay Longest Trip (IOI23_longesttrip) C++17
5 / 100
729 ms 1064 KB
#include "longesttrip.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
bool vis[500];
vector<int>v[500];
vector<int>ans;
void dfs(int a){
    vis[a]=1;
    ans.pb(a);
    for(auto b:v[a]){
        if(vis[b]==0){
            dfs(b);
        }
    }
}
std::vector<int> longest_trip(int N, int D)
{
    ans.clear();
    for(int i=0;i<N;i++){
        vis[i]=0;
        v[i].clear();
    }
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(are_connected({i},{j})){
                v[i].pb(j);
                v[j].pb(i);
            }
           
        }
    }
    for(int i=0;i<N;i++){
       if(v[i].size()==1){
           dfs(i);
           return ans;
       }
    }
    dfs(0);
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 141 ms 732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 18 ms 344 KB Output is correct
3 Correct 125 ms 464 KB Output is correct
4 Correct 348 ms 488 KB Output is correct
5 Correct 729 ms 976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 18 ms 344 KB Output is correct
3 Correct 110 ms 344 KB Output is correct
4 Correct 337 ms 344 KB Output is correct
5 Correct 691 ms 1064 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Incorrect 6 ms 344 KB Incorrect
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 22 ms 344 KB Output is correct
3 Correct 138 ms 344 KB Output is correct
4 Correct 320 ms 476 KB Output is correct
5 Correct 695 ms 884 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Incorrect 4 ms 344 KB Incorrect
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 18 ms 344 KB Output is correct
3 Partially correct 116 ms 344 KB Output is partially correct
4 Partially correct 384 ms 704 KB Output is partially correct
5 Partially correct 674 ms 832 KB Output is partially correct
6 Correct 7 ms 344 KB Output is correct
7 Incorrect 4 ms 344 KB Incorrect
8 Halted 0 ms 0 KB -