Submission #986937

# Submission time Handle Problem Language Result Execution time Memory
986937 2024-05-21T15:26:24 Z activedeltorre Longest Trip (IOI23_longesttrip) C++17
Compilation error
0 ms 0 KB
#include "longesttrip.h"
#include <deque>
#include <vector>
using namespace std;
deque<int>dq;
int fre[100005];
vector<int> longest_trip(int N, int D)
{
    int i,n=N,capst,capdr;
    vector<int>ans,pl1,pl2;
    pl1.push_back(1);
    pl2.push_back(0);
    if(are_connected(pl1,pl2)==1)
    {
        dq.push_front(0);
        dq.push_back(1);
        capst=0;
        capdr=1;
        fre[0]++;
        fre[1]++;
    }
    else
    {
        dq.push_front(0);
        dq.push_back(2);
        capst=0;
        capdr=2;
        fre[0]++;
        fre[2]++;
    }
    for(i=1;i<n;i++)
    {
        if(fre[i]==0)
        {
            pl1.clear();
            pl2.clear();
            pl1.push_back(capst);
            pl2.push_back(i);
            if(are_connected(pl1,pl2)==1)
            {
                capst=i;
                dq.push_front(i);
            }
            else
            {
                capdr=i;
                dq.push_back(i);
            }
        }
    }
    while(dq.size())
    {
        ans.push_back(dq.front());
        dq.pop_front();
    }
    while(dq.size())
    {
        dq.pop();
    }
    for(i=0;i<n;i++)
    {
        fre[i]=0;
    }
    return ans;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:58:12: error: 'class std::deque<int>' has no member named 'pop'
   58 |         dq.pop();
      |            ^~~