Submission #14506

#TimeUsernameProblemLanguageResultExecution timeMemory
14506nosiar올림픽 피자 (tutorial5)C++14
Compilation error
0 ms0 KiB
#include <queue> #include <cstring> #include <utility> #include "pizza.h" using namespace std; queue<int> orders[64]; int ingred[8]; int order_num; void Init() { memset(ingred, 0, sizeof(ingred)); for(int i = 0 ; i < 64; ++i) queue<int>().swap(orders[i]); order_num =0; } bool asdf(int ing) { bool succ= true; for(int i = 0 ; i< 8; ++i) { if((ing >> i)&1) { if(!ingred[i]) { succ = false; break; } } } return succ; } void asdf2(int ing) { { for(int i = 0 ; i< 8; ++i) { if((ing >> i)&1) { ingred[i]--; } } } } void Order(int N, int *A) { int ing = 0; for(int i = 0; i < N; ++i) { ing |= 1<<A[i]; } if(asdf(ing)) { asdf2(ing); Bake(order_num); } else orders[ing].push(order_num); order_num++; } void Delivery(int I) { ingred[I]++; int min_i=-1; int min_order_num = 987654321; for(int i = 0 ; i < 64; ++i) { if(!orders[i].empty() && asdf(ing)) { if(orders[i].front() < min_order_num) { min_order_num = orders[i].front(); min_i = i; } } } if(min_i != -1) { Bake(orders[min_i].front()); orders[min_i].pop(); } }

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: In function ‘void Delivery(int)’:
tutorial5.cpp:69:33: error: ‘ing’ was not declared in this scope
   if(!orders[i].empty() && asdf(ing))
                                 ^