답안 #744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
744 2013-03-01T16:13:31 Z CodingIsHard 올림픽 피자 (tutorial5) C++
20 / 100
79 ms 1228 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;
        for(int i = 1;i < 256;i++)
        {
            if((i & can) == i && !p[i].empty() && (iMin == -1 || p[i].front() < p[iMin].front()))
                iMin = i;
        }
        
        if(iMin == -1) break;
        
        Bake(p[iMin].front());
        p[iMin].pop();
        process(iMin);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1096 KB Output isn't correct
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
5 Halted 0 ms 0 KB -
6 Halted 0 ms 0 KB -
7 Halted 0 ms 0 KB -
8 Halted 0 ms 0 KB -
9 Halted 0 ms 0 KB -
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1096 KB Output isn't correct
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
5 Halted 0 ms 0 KB -
6 Halted 0 ms 0 KB -
7 Halted 0 ms 0 KB -
8 Halted 0 ms 0 KB -
9 Halted 0 ms 0 KB -
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 1096 KB Output is correct
2 Correct 70 ms 1096 KB Output is correct
3 Correct 69 ms 1096 KB Output is correct
4 Correct 65 ms 1096 KB Output is correct
5 Correct 68 ms 1228 KB Output is correct
6 Correct 71 ms 1228 KB Output is correct
7 Correct 63 ms 1096 KB Output is correct
8 Correct 72 ms 1228 KB Output is correct
9 Correct 68 ms 1096 KB Output is correct
10 Correct 68 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 79 ms 1096 KB Output isn't correct
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
5 Halted 0 ms 0 KB -
6 Halted 0 ms 0 KB -
7 Halted 0 ms 0 KB -
8 Halted 0 ms 0 KB -
9 Halted 0 ms 0 KB -
10 Halted 0 ms 0 KB -