이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstring>
#include "pizza.h"
#define C(a) memset((a),0,sizeof(a))
using namespace std;
int order[100000][8];
int ordered[100000];
int firstorder = -1;
int lastorder = -1;
int currentFood[8];
void Init()
{
C(order);
C(ordered);
}
void CheckAll()
{
for(int i = firstorder; i < lastorder; i++)
{
bool bakable = true;
for(int j = 0; j < 8; j++)
{
if(order[i][j] == 1 && currentFood[8] == 0)
bakable = false;
}
if(bakable)
{
Bake(i);
for(int j = 0; j < 8; j++)
{
if(order[i][j])
currentFood[j]--;
}
if(i == firstorder)
{
for(int j = firstorder+1; j < 100000; j++)
{
if(ordered[j])
{
firstorder = j;
}
}
}
}
}
}
void Order(int n, int* a)
{
if(firstorder == -1)
firstorder = 0;
lastorder++;
for(int i = 0; i < n; i++)
{
order[lastorder][a[i]]++;
ordered[i] = 1;
}
CheckAll();
}
void Delivery(int l)
{
currentFood[l]++;
CheckAll();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |