Submission #1059651

# Submission time Handle Problem Language Result Execution time Memory
1059651 2024-08-15T06:44:50 Z tolbi Longest Trip (IOI23_longesttrip) C++17
5 / 100
210 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 (vis[i]) continue;
            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 188 ms 344 KB too many calls
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 8 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 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Incorrect 193 ms 344 KB too many calls
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 6 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 210 ms 344 KB too many calls
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 8 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Incorrect 154 ms 344 KB too many calls
7 Halted 0 ms 0 KB -