Submission #27423

#TimeUsernameProblemLanguageResultExecution timeMemory
27423boh7978올림픽 피자 (tutorial5)C++14
20 / 100
1000 ms10808 KiB
#include "pizza.h" #include<malloc.h> int order_num; int elm[9]; typedef struct NODE { int id; int n; int topping[9]; NODE* next; }; NODE customer; void Init() { order_num = 0; for (int i = 0; i < 9; i++) { elm[i] = 0; } customer.id = -1; customer.n = 0; customer.next = 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 { NODE* nnode = new NODE; nnode->id = order_num; nnode->n = N; for (int i = 0; i < N; i++) { nnode->topping[i] = A[i]; } nnode->next = customer.next;; customer.next = nnode; } order_num++; } void Delivery(int I) { elm[I]++; NODE* cur = new NODE; NODE* pre= new NODE; cur = &customer; pre = &customer; while (cur != 0) { if (cur->n != 0) { bool ready = true; for (int i = 0; i < cur->n; i++) { if (elm[cur->topping[i]] == 0) { ready = false; break; } } if (ready) { Bake(cur->id); for (int i = 0; i < cur->n; i++) { elm[cur->topping[i]]--; } pre->next = cur->next; break; } } pre = cur; cur = cur->next; } }

Compilation message (stderr)

grader.cpp: In function 'int main(int, char**)':
grader.cpp:65:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
tutorial5.cpp:13:1: warning: 'typedef' was ignored in this declaration
 };
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...