# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143128 | 2019-08-13T06:43:40 Z | bupjae | 올림픽 피자 (tutorial5) | C++17 | 83 ms | 2828 KB |
#include "pizza.h" #include <algorithm> #include <list> int next_id; int have_mask; int have[8]; std::list<int> *orders[256]; void Init() { next_id = 0; have_mask = 0; std::fill(have, have + 8, 0); for (int i = 0; i < 256; i++) { if (orders[i] != nullptr) delete orders[i]; orders[i] = new std::list<int>(); } } void check() { while (true) { int id = -1; int need; for (int i = 0; i < 256; i++) { if ((have_mask | i) != have_mask || orders[i]->empty()) continue; int tid = orders[i]->front(); if (id == -1 || id > tid) { need = i; id = tid; } } if (id == -1) break; Bake(id); orders[need]->pop_front(); for (int i = 0; i < 8; i++) if ((need & (1 << i)) != 0 && --have[i] == 0) have_mask &= ~(1 << i); } } void Order(int N, int *A) { int k = 0; for (int i = 0; i < N; i++) k |= 1 << A[i]; orders[k]->push_back(next_id++); check(); } void Delivery(int I) { if (have[I] == 0) have_mask |= 1 << I; have[I]++; check(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 252 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 376 KB | Output is correct |
3 | Correct | 6 ms | 380 KB | Output is correct |
4 | Correct | 6 ms | 376 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 6 ms | 376 KB | Output is correct |
7 | Correct | 6 ms | 380 KB | Output is correct |
8 | Correct | 6 ms | 376 KB | Output is correct |
9 | Correct | 6 ms | 376 KB | Output is correct |
10 | Correct | 6 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 1244 KB | Output is correct |
2 | Correct | 77 ms | 2464 KB | Output is correct |
3 | Correct | 72 ms | 1904 KB | Output is correct |
4 | Correct | 77 ms | 2424 KB | Output is correct |
5 | Correct | 81 ms | 2680 KB | Output is correct |
6 | Correct | 81 ms | 2828 KB | Output is correct |
7 | Correct | 72 ms | 1656 KB | Output is correct |
8 | Correct | 78 ms | 2808 KB | Output is correct |
9 | Correct | 75 ms | 2268 KB | Output is correct |
10 | Correct | 70 ms | 1656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 81 ms | 1784 KB | Output is correct |
2 | Correct | 81 ms | 2296 KB | Output is correct |
3 | Correct | 83 ms | 2476 KB | Output is correct |
4 | Correct | 83 ms | 2424 KB | Output is correct |
5 | Correct | 81 ms | 2296 KB | Output is correct |
6 | Correct | 83 ms | 2248 KB | Output is correct |
7 | Correct | 81 ms | 2300 KB | Output is correct |
8 | Correct | 81 ms | 2296 KB | Output is correct |
9 | Correct | 83 ms | 2296 KB | Output is correct |
10 | Correct | 82 ms | 2356 KB | Output is correct |