Submission #841296

# Submission time Handle Problem Language Result Execution time Memory
841296 2023-09-01T12:59:54 Z Stavab Longest Trip (IOI23_longesttrip) C++17
Compilation error
0 ms 0 KB
#include "longesttrip.h"
#include <algorithm>

std::vector<int> longest_trip(int N, int D)
{
    std::vector<int> solution;
    int node = 0;

    while(node < N - 1)
    {
        solution.push_back(node);
        if(are_connected({node}, {node + 1}))
        {
            solution.push_back(node + 1);
            node++;
        }
        else if(node != N - 2)
        {
            solution.push_back(node + 2);
            solution.push_back(node + 1);
            node += 2;
        }
        else
        {
            reverse(solution.begin(), solution.end());
            solution.push_beck(N - 1);
            node++;
        }
    }

    return solution;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:26:22: error: 'class std::vector<int>' has no member named 'push_beck'; did you mean 'push_back'?
   26 |             solution.push_beck(N - 1);
      |                      ^~~~~~~~~
      |                      push_back