Submission #18968

#TimeUsernameProblemLanguageResultExecution timeMemory
18968dltldls95올림픽 피자 (tutorial5)C++98
Compilation error
0 ms0 KiB
#include "pizza.h" #define C(a) memset((a),0,sizeof(a)) int order[N][8]; int ordered[N]; //int foodorder[8][N]; //vector<int> foods[8]; //queue<int> orders; int firstorder = -1; int lastorder = -1; int currentFood[8]; void Init() { C(order); C(ordered); } void CheckAll() { for (int i = firstorder; i <= lastorder; i++) { if (!ordered[i]) continue; bool bakable = true; for (int j = 0; j < 8; j++) { if (order[i][j] == 1 && currentFood[j] == 0) { bakable = false; break; } } if (bakable) { Bake(i); ordered[i] = 0; for (int j = 0; j < 8; j++) { if (order[i][j]) { currentFood[j]--; } } if (i > firstorder) { firstorder++; debug(firstorder); /*for (int j = i + 1; j < N; j++) { if (ordered[j]) { firstorder = j; debug(firstorder); break; } }*/ } } } } void Order(int n, int* a) { if (firstorder == -1) firstorder = 0; lastorder++; ordered[lastorder] = 1; for (int i = 0; i < n; i++) { //foods[lastorder].push_back(a[i]); order[lastorder][a[i]]++; } CheckAll(); } void Delivery(int l) { currentFood[l]++; CheckAll(); }

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:4:11: error: ‘N’ was not declared in this scope
 int order[N][8];
           ^
tutorial5.cpp:5:13: error: ‘N’ was not declared in this scope
 int ordered[N];
             ^
tutorial5.cpp: In function ‘void Init()’:
tutorial5.cpp:14:5: error: ‘order’ was not declared in this scope
   C(order);
     ^
tutorial5.cpp:2:22: note: in definition of macro ‘C’
 #define C(a) memset((a),0,sizeof(a))
                      ^
tutorial5.cpp:2:36: error: ‘memset’ was not declared in this scope
 #define C(a) memset((a),0,sizeof(a))
                                    ^
tutorial5.cpp:14:3: note: in expansion of macro ‘C’
   C(order);
   ^
tutorial5.cpp:15:5: error: ‘ordered’ was not declared in this scope
   C(ordered);
     ^
tutorial5.cpp:2:22: note: in definition of macro ‘C’
 #define C(a) memset((a),0,sizeof(a))
                      ^
tutorial5.cpp: In function ‘void CheckAll()’:
tutorial5.cpp:22:10: error: ‘ordered’ was not declared in this scope
     if (!ordered[i])
          ^
tutorial5.cpp:27:11: error: ‘order’ was not declared in this scope
       if (order[i][j] == 1 && currentFood[j] == 0)
           ^
tutorial5.cpp:38:7: error: ‘ordered’ was not declared in this scope
       ordered[i] = 0;
       ^
tutorial5.cpp:41:13: error: ‘order’ was not declared in this scope
         if (order[i][j])
             ^
tutorial5.cpp:51:25: error: ‘debug’ was not declared in this scope
         debug(firstorder);
                         ^
tutorial5.cpp: In function ‘void Order(int, int*)’:
tutorial5.cpp:72:3: error: ‘ordered’ was not declared in this scope
   ordered[lastorder] = 1;
   ^
tutorial5.cpp:76:5: error: ‘order’ was not declared in this scope
     order[lastorder][a[i]]++;
     ^