#include "pizza.h"
#include <queue>
#include <algorithm>
using namespace std;
const int INF=987654321;
queue<int> pizza[1<<8];
int on=0,cnt[8];
void Init(){
}
void chk(){
int avpiz=0, minnum=INF, minq;
for(int i=0;i<8;i++)
if(cnt[i]) avpiz|=1<<i;
for(int i=0;i<1<<8;i++){
if(i - (i & avpiz) == 0 && !pizza[i].empty()){
if(minnum>pizza[i].front()){
minnum=pizza[i].front();
minq=i;
}
}
}
if(minnum!=INF){
Bake(minnum); pizza[minq].pop();
for(int i=0;i<8;i++)
if(minq & (1<<i)){
cnt[i]--;
}
}
}
void Order(int N, int *A){
int nowpiz=0;
for(int i=0;i<N;i++)
nowpiz|=1<<A[i];
pizza[nowpiz].push(on++);
chk();
}
void Delivery(int I){
cnt[I]++;
chk();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1728 KB |
Output is correct |
2 |
Correct |
0 ms |
1728 KB |
Output is correct |
3 |
Correct |
0 ms |
1728 KB |
Output is correct |
4 |
Correct |
0 ms |
1728 KB |
Output is correct |
5 |
Correct |
0 ms |
1728 KB |
Output is correct |
6 |
Correct |
0 ms |
1728 KB |
Output is correct |
7 |
Correct |
0 ms |
1728 KB |
Output is correct |
8 |
Correct |
0 ms |
1728 KB |
Output is correct |
9 |
Correct |
0 ms |
1728 KB |
Output is correct |
10 |
Correct |
0 ms |
1728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
1728 KB |
Output is correct |
2 |
Correct |
5 ms |
1728 KB |
Output is correct |
3 |
Correct |
4 ms |
1728 KB |
Output is correct |
4 |
Correct |
4 ms |
1728 KB |
Output is correct |
5 |
Correct |
5 ms |
1728 KB |
Output is correct |
6 |
Correct |
2 ms |
1728 KB |
Output is correct |
7 |
Correct |
4 ms |
1728 KB |
Output is correct |
8 |
Correct |
4 ms |
1728 KB |
Output is correct |
9 |
Correct |
6 ms |
1728 KB |
Output is correct |
10 |
Correct |
2 ms |
1728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
81 ms |
1728 KB |
Output is correct |
2 |
Correct |
94 ms |
1728 KB |
Output is correct |
3 |
Correct |
84 ms |
1728 KB |
Output is correct |
4 |
Correct |
92 ms |
1728 KB |
Output is correct |
5 |
Correct |
88 ms |
1860 KB |
Output is correct |
6 |
Correct |
94 ms |
1860 KB |
Output is correct |
7 |
Correct |
81 ms |
1728 KB |
Output is correct |
8 |
Correct |
91 ms |
1860 KB |
Output is correct |
9 |
Correct |
93 ms |
1728 KB |
Output is correct |
10 |
Correct |
83 ms |
1728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
96 ms |
1728 KB |
Output is correct |
2 |
Correct |
96 ms |
1728 KB |
Output is correct |
3 |
Correct |
95 ms |
1728 KB |
Output is correct |
4 |
Correct |
88 ms |
1728 KB |
Output is correct |
5 |
Correct |
88 ms |
1728 KB |
Output is correct |
6 |
Correct |
92 ms |
1728 KB |
Output is correct |
7 |
Correct |
92 ms |
1728 KB |
Output is correct |
8 |
Correct |
92 ms |
1728 KB |
Output is correct |
9 |
Correct |
98 ms |
1728 KB |
Output is correct |
10 |
Correct |
87 ms |
1728 KB |
Output is correct |