#include "pizza.h"
#include <vector>
using namespace std;
int num , can;
int pos[256] , rest[8];
vector<int> p[256];
void Init() {}
void process(int pizza)
{
pos[pizza]++;
for(int i = 0;i < 8;i++)
{
if(pizza & (1 << i))
{
rest[i]--;
if(rest[i] == 0)
can ^= 1 << i;
}
}
}
void Order(int N, int *A)
{
int pizza = 0;
for(int i = 0;i < N;i++)
pizza |= 1 << A[i];
p[pizza].push_back(num++);
if((pizza & can) == pizza)
process(pizza) , Bake(num - 1);
}
void Delivery(int I)
{
if(++rest[I] == 1)
can |= 1 << I;
bool con;
do
{
int iMin = -1;
con = false;
for(int i = 1;i < 256;i++)
{
if((i & can) == i && pos[i] != p[i].size() && (iMin == -1 || p[i][pos[i]] < p[iMin][pos[iMin]]))
{
iMin = i;
con = true;
}
}
if(con)
Bake(p[iMin][pos[iMin]]) , process(iMin);
} while (con);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
948 KB |
Output is correct |
2 |
Correct |
0 ms |
948 KB |
Output is correct |
3 |
Correct |
0 ms |
948 KB |
Output is correct |
4 |
Correct |
0 ms |
948 KB |
Output is correct |
5 |
Correct |
0 ms |
948 KB |
Output is correct |
6 |
Correct |
0 ms |
948 KB |
Output is correct |
7 |
Correct |
0 ms |
948 KB |
Output is correct |
8 |
Correct |
0 ms |
948 KB |
Output is correct |
9 |
Correct |
0 ms |
948 KB |
Output is correct |
10 |
Correct |
0 ms |
948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
948 KB |
Output is correct |
2 |
Correct |
2 ms |
948 KB |
Output is correct |
3 |
Correct |
4 ms |
948 KB |
Output is correct |
4 |
Correct |
3 ms |
948 KB |
Output is correct |
5 |
Correct |
4 ms |
948 KB |
Output is correct |
6 |
Correct |
2 ms |
948 KB |
Output is correct |
7 |
Correct |
3 ms |
948 KB |
Output is correct |
8 |
Correct |
3 ms |
948 KB |
Output is correct |
9 |
Correct |
3 ms |
948 KB |
Output is correct |
10 |
Correct |
3 ms |
948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
1080 KB |
Output is correct |
2 |
Correct |
77 ms |
1212 KB |
Output is correct |
3 |
Correct |
73 ms |
1080 KB |
Output is correct |
4 |
Correct |
75 ms |
1212 KB |
Output is correct |
5 |
Correct |
76 ms |
1212 KB |
Output is correct |
6 |
Correct |
78 ms |
1220 KB |
Output is correct |
7 |
Correct |
74 ms |
1080 KB |
Output is correct |
8 |
Correct |
75 ms |
1212 KB |
Output is correct |
9 |
Correct |
78 ms |
1212 KB |
Output is correct |
10 |
Correct |
77 ms |
1080 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
1212 KB |
Output is correct |
2 |
Correct |
79 ms |
1212 KB |
Output is correct |
3 |
Correct |
76 ms |
1212 KB |
Output is correct |
4 |
Correct |
74 ms |
1212 KB |
Output is correct |
5 |
Correct |
83 ms |
1212 KB |
Output is correct |
6 |
Correct |
77 ms |
1212 KB |
Output is correct |
7 |
Correct |
75 ms |
1212 KB |
Output is correct |
8 |
Correct |
77 ms |
1212 KB |
Output is correct |
9 |
Correct |
76 ms |
1216 KB |
Output is correct |
10 |
Correct |
81 ms |
1212 KB |
Output is correct |