# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29948 | boh7978 | 올림픽 피자 (tutorial5) | C++14 | 63 ms | 5804 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"
#define SIZE 100005
int order_num;
int elm[9];
typedef struct myd {
int order_num;
int n;
int A[10];
};
int cnt;
myd cust[SIZE];
void Init() {
order_num = 0;
cnt = 0;
for (int i = 0; i < 10; i++) {
elm[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 {
cust[cnt].order_num = order_num;
cust[cnt].n = N;
for (int i = 0; i < N; i++) {
cust[cnt].A[i] = A[i];
}
cnt++;
}
order_num++;
}
void Delivery(int I) {
elm[I]++;
for (int c = 0; c < cnt; c++) {
bool ready = true;
for (int i = 0; i < cust[c].n; i++) {
if (elm[cust[c].A[i]] == 0) { ready = false; break; }
}
if (ready) {
for (int i = 0; i < cust[c].n; i++) {
elm[cust[c].A[i]]--;
}
cust[c].order_num = 0;
cust[c].n = 0;
cnt--;
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... |