Submission #27409

#TimeUsernameProblemLanguageResultExecution timeMemory
27409boh7978올림픽 피자 (tutorial5)C++14
70 / 100
1000 ms5024 KiB
#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)

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 Init()':
tutorial5.cpp:13:14: warning: iteration 9u invokes undefined behavior [-Waggressive-loop-optimizations]
    elm[i] = 0;
              ^
tutorial5.cpp:12:21: note: containing loop
   for (int i = 0; i < 10; i++) {
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...