#include "pizza.h"
int order_num;
int remained[8];
int order[100000];
int completed_order;
int trans[8] = {
1, 2, 4, 8, 16, 32, 64, 128
};
void Init() {
int i;
order_num = 0;
completed_order = 0;
for (i = 0; i < 100000; i++) {
order[i] = 0;
}
for (i = 0; i < 8; i++) {
remained[i] = 0;
}
}
void Order(int N, int *A) {
int i, j, k, need;
need = 0;
for (i = 0; i < N; i++) {
j = *(A + i);
if (!remained[j]) {
need = need | trans[i];
}
}
if (need) {
order[order_num] = need;
}
else {
for (i = 0; i < N; i++) {
j = *(A + i);
remained[j]--;
}
Bake(order_num);
if (completed_order == order_num - 1) completed_order = order_num;
}
order_num++;
}
void Delivery(int I) {
int i, j, k, need;
remained[I]++;
if (remained[I] >= 2) return;
need = 0;
for (i = completed_order + 1; i < order_num; i++) {
if (order[i] & trans[I]) {
for (j = 0; j < 8; j++) {
if (order[i] & trans[j]) {
if (!remained[j]) need = need | trans[j];
}
}
if (!need) break;
}
}
if (!need) {
for (j = 0; j < 8; j++)
if (order[i] & trans[j]) remained[j]--;
Bake(i);
if (completed_order == order_num - 1) completed_order = order_num;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
1472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
1472 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |