#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);
}
void Delivery(int I)
{
if(!rest[I])
can |= 1 << I;
rest[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)
process(iMin);
} while (con);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
5 |
Halted |
0 ms |
0 KB |
- |
6 |
Halted |
0 ms |
0 KB |
- |
7 |
Halted |
0 ms |
0 KB |
- |
8 |
Halted |
0 ms |
0 KB |
- |
9 |
Halted |
0 ms |
0 KB |
- |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
5 |
Halted |
0 ms |
0 KB |
- |
6 |
Halted |
0 ms |
0 KB |
- |
7 |
Halted |
0 ms |
0 KB |
- |
8 |
Halted |
0 ms |
0 KB |
- |
9 |
Halted |
0 ms |
0 KB |
- |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
1080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
5 |
Halted |
0 ms |
0 KB |
- |
6 |
Halted |
0 ms |
0 KB |
- |
7 |
Halted |
0 ms |
0 KB |
- |
8 |
Halted |
0 ms |
0 KB |
- |
9 |
Halted |
0 ms |
0 KB |
- |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
1212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
5 |
Halted |
0 ms |
0 KB |
- |
6 |
Halted |
0 ms |
0 KB |
- |
7 |
Halted |
0 ms |
0 KB |
- |
8 |
Halted |
0 ms |
0 KB |
- |
9 |
Halted |
0 ms |
0 KB |
- |
10 |
Halted |
0 ms |
0 KB |
- |