# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
18575 |
2016-02-09T14:06:17 Z |
jjhstop |
올림픽 피자 (tutorial5) |
C++ |
|
74 ms |
1732 KB |
#include "pizza.h"
#include <queue>
using namespace std;
queue<int> Q[256];
int order_num;
int ingred[9];
int delivered;
void Init() {
order_num = 0;
}
void process(void)
{
while (1) {
int chk = -1;
for (int i = delivered; i > 0; i--) {
if (!Q[i].empty() && (chk < 0 || Q[chk].front() > Q[i].front())) chk = i;
}
if (chk < 0) return;
Bake(Q[chk].front());
Q[chk].pop();
for (int i = 0; i < 8; i++) {
if (chk & (1 << i)) {
ingred[i]--;
if (ingred[i] == 0) delivered ^= (1 << i);
}
}
}
}
void Order(int N, int *A) {
int ordering = 0;
for (int i = 0; i < N; i++) {
ordering |= (1 << A[i]);
}
Q[ordering].push(order_num);
order_num++;
process();
}
void Delivery(int i) {
ingred[i]++;
if (ingred[i] == 1) {
delivered |= (1 << i);
}
process();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1732 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
1732 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
65 ms |
1732 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
74 ms |
1732 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |