Submission #1059650

# Submission time Handle Problem Language Result Execution time Memory
1059650 2024-08-15T06:44:12 Z tolbi Longest Trip (IOI23_longesttrip) C++17
0 / 100
0 ms 344 KB
#include "longesttrip.h"

//bool are_connected(std::vector<int> A, std::vector<int> B);
bool sor(int x, int y){
    std::vector<int> ilk;
    std::vector<int> iki;
    ilk.push_back(x);
    iki.push_back(y);
    return are_connected(ilk,iki);
}
std::vector<int> longest_trip(int N, int D)
{
    std::vector<int> ans;
    ans.push_back(0);
    std::vector<bool> vis(N,false);
    vis[0]=true;
    while (ans.size()<N){
        for (int i = 0; i < N; i++){
            if (sor(ans.back(),i)){
                ans.push_back(i);
                vis[i]=true;
                break;
            }
        }
    }
    return ans;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:17:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |     while (ans.size()<N){
      |            ~~~~~~~~~~^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB non-disjoint arrays
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB non-disjoint arrays
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB non-disjoint arrays
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB non-disjoint arrays
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB non-disjoint arrays
2 Halted 0 ms 0 KB -