#include <cstdio>
#include <algorithm>
#include <queue>

using namespace std;

int main()
{
    int n,m;
    scanf("%d",&n,&m);

    int price[105]={}
    for(int i=0; i<n; i++)
    {
        scanf("%d",&price[i]);
    }

    int weight[2005]={};
    for(int i=0; i<m; i++)
    {
        scanf("%d",&weight[i]);
    }

    int order[4005]={};
    for(int i=0; i<2*m; i++)
    {
        scanf("%d",&order[i]);
    }

    queue<int> q;
    int parking[105]={};
    int pc=0;
    for(int i=0; i<2*m; i++)
    {
        if(order[i]>0)
        {
          if(q.empty() && parking[n]==0)
          {
              parking(pc)=1;
              pc++;
          }
          else if(parking[n]==1)
          {
              q.push(order[i]);
          }
        }
        else
        {
            
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: