Submission #1132700

#TimeUsernameProblemLanguageResultExecution timeMemory
1132700SpyrosAlivLongest Trip (IOI23_longesttrip)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
//#define int long long

//bool are_connected(vector<int> a, vector<int> b);

vector<int> longest_trip(int n, int d) {
    if (d == 3) {
        vector<int> ans;
        for (int i = 0; i < n; i++) ans.push_back(i);
        return ans;
    }
    else if (d == 2) {
        vector<int> ans;
        ans.push_back(0);
        for (int i = 0; i < n-1; i++) {
            bool x = are_connected({i}, {i+1});
            if (x) {
                ans.push_back(i+1);
                continue;
            }
            else {
                ans.push_back(i+2);
                ans.push_back(i+1);
                i++;
            }
        }
        return ans;
    }
    return {};
}

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:17:22: error: 'are_connected' was not declared in this scope; did you mean 'SYS_connect'?
   17 |             bool x = are_connected({i}, {i+1});
      |                      ^~~~~~~~~~~~~
      |                      SYS_connect