Submission #927558

# Submission time Handle Problem Language Result Execution time Memory
927558 2024-02-15T04:32:53 Z aykhn Longest Trip (IOI23_longesttrip) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "longesttrip.h"

using namespace std;

vector<int> longest_trip(int n, int d)
{
    vector<int> used(n, 0);
    deque<int> dq;
    used[0] = 1;
    dq.push_back(0);
    if (are_connected({0}, {1})) dq.push_back(1), used[1] = 1;
    else dq.push_back(2), used[2] = 1;
    for (int i = 0; i < n; i++)
    {
        if (used[i]) continue;
        if (are_connected({dq.back(), i})) dq.push_back(i);
        else dq.push_front(i);
        used[i] = 1;
    }
    vector<int> res;
    while (!dq.empty()) res.push_back(dq.front()), dq.pop_front();
    return res;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:17:41: error: too few arguments to function 'bool are_connected(std::vector<int>, std::vector<int>)'
   17 |         if (are_connected({dq.back(), i})) dq.push_back(i);
      |                                         ^
In file included from longesttrip.cpp:2:
longesttrip.h:5:6: note: declared here
    5 | bool are_connected(std::vector<int> A, std::vector<int> B);
      |      ^~~~~~~~~~~~~