Submission #742

# Submission time Handle Problem Language Result Execution time Memory
742 2013-03-01T16:10:29 Z CodingIsHard 올림픽 피자 (tutorial5) C++
Compilation error
0 ms 0 KB
#include "pizza.h"
#include <queue>
using namespace std;

int num , can;
int rest[8];
queue<int> p[256];

void Init() {}

void process(int pizza)
{
    for(int i = 0;i < 8;i++)
    {
        if(pizza & (1 << i))
        {
            rest[i]--;
            if(rest[i] == 0)
                can ^= 1 << i;
        }
    }
}

void Order(int N, int *A)
{
    int pizza = 0;
    for(int i = 0;i < N;i++)
        pizza |= 1 << A[i];
    
    p[pizza].push(num++);
    if((pizza & can) == pizza)
        Bake(num - 1) , process(pizza);
}

void Delivery(int I)
{
    if(++rest[I] == 1)
        can |= 1 << I;

    while(true)
    {
        int iMin = -1;
        con = false;
        for(int i = 1;i < 256;i++)
        {
            if((i & can) == i && !p[i].empty() && (iMin == -1 || p[i].front() < p[iMin].front()))
            {
                iMin = i;
                con = true;
            }
        }
        
        if(iMin == -1) break;
        
        Bake(p[iMin].front());
        p[iMin].pop();
        process(iMin);
    }
}

Compilation message

tutorial5.cpp: In function 'void Delivery(int)':
tutorial5.cpp:43: error: 'con' was not declared in this scope