Submission #1007022

# Submission time Handle Problem Language Result Execution time Memory
1007022 2024-06-24T10:57:16 Z 3as8 Longest Trip (IOI23_longesttrip) C++17
5 / 100
8 ms 348 KB
#include "longesttrip.h"

#include<bits/stdc++.h>

#define ll long long
using namespace std;

bool con[300][300];
bool vis[300];

ll n;
void dfs(ll startIndex, vector<int>& curr) {


    vis[startIndex] = true;
    curr.push_back(startIndex);

    for(int i = 0; i < n; i++) {
        if(!vis[i] && are_connected({startIndex}, {i})) {
            dfs(i, curr);
        }
    }

}


std::vector<int> longest_trip(int N, int D) {

    n = N;


    vector<ll> ans;
    ll mx = LLONG_MIN;
    for(int j = 0; j < n; j++) vis[j] = false;

    vector<int> curr;
    dfs(0, curr);

    return curr;
}

Compilation message

longesttrip.cpp: In function 'void dfs(long long int, std::vector<int>&)':
longesttrip.cpp:19:38: warning: narrowing conversion of 'startIndex' from 'long long int' to 'int' [-Wnarrowing]
   19 |         if(!vis[i] && are_connected({startIndex}, {i})) {
      |                                      ^~~~~~~~~~
longesttrip.cpp:19:38: warning: narrowing conversion of 'startIndex' from 'long long int' to 'int' [-Wnarrowing]
longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:33:8: warning: unused variable 'mx' [-Wunused-variable]
   33 |     ll mx = LLONG_MIN;
      |        ^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 2 ms 340 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 6 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 6 ms 344 KB Output is correct
4 Correct 6 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 -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 7 ms 344 KB Output is correct
5 Correct 7 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 8 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 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 -