This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "pizza.h"
#include <list>
using namespace std;
list<int> dq;
list<int> num;
int order_num;
int ingredients[8], ingnow;
void Init() {
order_num = 0;
}
void deliver(){
list<int> ::iterator it = dq.begin(), it2 = num.begin();
while(it != dq.end()) {
if(((*it) & ~ingnow) == 0){
Bake((*it2));
for (int j=0; j<8; j++) {
if(((*it)>>j)&1){
ingredients[j]--;
if(ingredients[j] == 0){
ingnow ^= (1<<j);
}
}
}
it = dq.erase(it);
it2 = num.erase(it2);
}
else{
it++;
it2++;
}
}
}
void Order(int N, int *A) {
int bitfield = 0;
for (int i=0; i<N; i++) {
bitfield |= (1 << A[i]);
}
dq.push_back(bitfield);
num.push_back(order_num++);
deliver();
}
void Delivery(int I) {
ingredients[I]++;
if(ingredients[I] == 1) ingnow |= (1<<I);
deliver();
}
# | 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... |