# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
12892 |
2015-01-18T17:24:23 Z |
gs13105 |
올림픽 피자 (tutorial5) |
C++ |
|
56 ms |
1392 KB |
#include "pizza.h"
#include <queue>
std::queue<int> q[256];
int num[8];
int s;
int c;
void Init()
{
}
void Order(int n, int *a)
{
bool u=1;
int i;
for(i=0;i<n;i++)
{
if(!num[a[i]])
{
u=0;
break;
}
}
if(u)
{
Bake(c);
for(i=0;i<n;i++)
{
num[a[i]]--;
if(!num[a[i]])
s^=(1<<a[i]);
}
}
else
{
int r=0;
for(i=0;i<n;i++)
r|=(1<<a[i]);
q[r].push(c);
}
c++;
}
void Delivery(int a)
{
if(!num[a])
s|=(1<<a);
num[a]++;
if(num[a]==1)
{
int m=100000,r,i;
for(i=s;i>=1;i=(i-1)&s)
{
if(!(i&(1<<a)))
continue;
if(!q[i].empty()&&q[i].front()<m)
{
m=q[i].front();
r=i;
}
}
if(m!=100000)
{
Bake(q[r].front());
q[r].pop();
for(i=0;i<8;i++)
{
if(r&(1<<i))
{
num[i]--;
if(!num[i])
s^=(1<<i);
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1392 KB |
Output is correct |
2 |
Correct |
0 ms |
1392 KB |
Output is correct |
3 |
Correct |
0 ms |
1392 KB |
Output is correct |
4 |
Correct |
0 ms |
1392 KB |
Output is correct |
5 |
Correct |
0 ms |
1392 KB |
Output is correct |
6 |
Correct |
0 ms |
1392 KB |
Output is correct |
7 |
Correct |
0 ms |
1392 KB |
Output is correct |
8 |
Correct |
0 ms |
1392 KB |
Output is correct |
9 |
Correct |
0 ms |
1392 KB |
Output is correct |
10 |
Correct |
0 ms |
1392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1392 KB |
Output is correct |
2 |
Correct |
0 ms |
1392 KB |
Output is correct |
3 |
Correct |
0 ms |
1392 KB |
Output is correct |
4 |
Correct |
0 ms |
1392 KB |
Output is correct |
5 |
Correct |
4 ms |
1392 KB |
Output is correct |
6 |
Correct |
4 ms |
1392 KB |
Output is correct |
7 |
Correct |
4 ms |
1392 KB |
Output is correct |
8 |
Correct |
0 ms |
1392 KB |
Output is correct |
9 |
Correct |
0 ms |
1392 KB |
Output is correct |
10 |
Correct |
0 ms |
1392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
1392 KB |
Output is correct |
2 |
Correct |
36 ms |
1392 KB |
Output is correct |
3 |
Correct |
36 ms |
1392 KB |
Output is correct |
4 |
Correct |
48 ms |
1392 KB |
Output is correct |
5 |
Correct |
52 ms |
1392 KB |
Output is correct |
6 |
Correct |
44 ms |
1392 KB |
Output is correct |
7 |
Correct |
28 ms |
1392 KB |
Output is correct |
8 |
Correct |
40 ms |
1392 KB |
Output is correct |
9 |
Correct |
48 ms |
1392 KB |
Output is correct |
10 |
Correct |
36 ms |
1392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
1392 KB |
Output is correct |
2 |
Correct |
52 ms |
1392 KB |
Output is correct |
3 |
Correct |
40 ms |
1392 KB |
Output is correct |
4 |
Correct |
52 ms |
1392 KB |
Output is correct |
5 |
Correct |
56 ms |
1392 KB |
Output is correct |
6 |
Correct |
56 ms |
1392 KB |
Output is correct |
7 |
Correct |
56 ms |
1392 KB |
Output is correct |
8 |
Correct |
52 ms |
1392 KB |
Output is correct |
9 |
Correct |
48 ms |
1392 KB |
Output is correct |
10 |
Correct |
48 ms |
1392 KB |
Output is correct |