# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
18576 |
2016-02-09T14:08:28 Z |
jjhstop |
올림픽 피자 (tutorial5) |
C++ |
|
88 ms |
1864 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 = (i - 1) & delivered) {
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 |
Correct |
0 ms |
1732 KB |
Output is correct |
2 |
Correct |
0 ms |
1732 KB |
Output is correct |
3 |
Correct |
0 ms |
1732 KB |
Output is correct |
4 |
Correct |
0 ms |
1732 KB |
Output is correct |
5 |
Correct |
0 ms |
1732 KB |
Output is correct |
6 |
Correct |
0 ms |
1732 KB |
Output is correct |
7 |
Correct |
0 ms |
1732 KB |
Output is correct |
8 |
Correct |
0 ms |
1732 KB |
Output is correct |
9 |
Correct |
0 ms |
1732 KB |
Output is correct |
10 |
Correct |
0 ms |
1732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1732 KB |
Output is correct |
2 |
Correct |
2 ms |
1732 KB |
Output is correct |
3 |
Correct |
0 ms |
1732 KB |
Output is correct |
4 |
Correct |
2 ms |
1732 KB |
Output is correct |
5 |
Correct |
3 ms |
1732 KB |
Output is correct |
6 |
Correct |
4 ms |
1732 KB |
Output is correct |
7 |
Correct |
3 ms |
1732 KB |
Output is correct |
8 |
Correct |
3 ms |
1732 KB |
Output is correct |
9 |
Correct |
3 ms |
1732 KB |
Output is correct |
10 |
Correct |
2 ms |
1732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
88 ms |
1732 KB |
Output is correct |
2 |
Correct |
84 ms |
1732 KB |
Output is correct |
3 |
Correct |
82 ms |
1732 KB |
Output is correct |
4 |
Correct |
87 ms |
1732 KB |
Output is correct |
5 |
Correct |
77 ms |
1864 KB |
Output is correct |
6 |
Correct |
86 ms |
1864 KB |
Output is correct |
7 |
Correct |
87 ms |
1732 KB |
Output is correct |
8 |
Correct |
76 ms |
1864 KB |
Output is correct |
9 |
Correct |
79 ms |
1732 KB |
Output is correct |
10 |
Correct |
75 ms |
1732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
61 ms |
1732 KB |
Output is correct |
2 |
Correct |
47 ms |
1732 KB |
Output is correct |
3 |
Correct |
47 ms |
1732 KB |
Output is correct |
4 |
Correct |
51 ms |
1732 KB |
Output is correct |
5 |
Correct |
63 ms |
1732 KB |
Output is correct |
6 |
Correct |
62 ms |
1732 KB |
Output is correct |
7 |
Correct |
55 ms |
1732 KB |
Output is correct |
8 |
Correct |
59 ms |
1732 KB |
Output is correct |
9 |
Correct |
61 ms |
1732 KB |
Output is correct |
10 |
Correct |
28 ms |
1732 KB |
Output is correct |