# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27409 | boh7978 | 올림픽 피자 (tutorial5) | C++14 | 1000 ms | 5024 KiB |
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"
int order_num;
int elm[9];
int customer[100111][10]; //8: N 9:able
void Init() {
order_num = 0;
for (int j = 0; j < 100111; j++) {
for (int i = 0; i < 10; i++) {
elm[i] = 0;
if (customer[j][9] != 0) {
customer[j][i] = 0;
}
}
}
}
void Order(int N, int *A) {
bool ready = true;
for (int i = 0; i < N; i++) {
if (elm[A[i]] == 0) { ready = false; break; }
}
if (ready) {
Bake(order_num);
for (int i = 0; i < N; i++) {
elm[A[i]]--;
}
}
else {
customer[order_num][9] = 1;
customer[order_num][8] = N;
for (int i = 0; i < N; i++) {
customer[order_num][i] = A[i];
}
}
order_num++;
}
void Delivery(int I) {
elm[I]++;
for (int c = 0; c < order_num; c++) {
bool ready = true;
if (customer[c][9]) {
for (int i = 0; i < customer[c][8]; i++) {
if (elm[customer[c][i]] == 0) { ready = false; break; }
}
if (ready) {
customer[c][9] = 0;
for (int i = 0; i < customer[c][8]; i++) {
elm[customer[c][i]]--;
}
Bake(c);
break;
}
}
}
}
Compilation message (stderr)
# | 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... |