# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
5296 |
2014-03-19T09:15:29 Z |
baneling100 |
올림픽 피자 (tutorial5) |
C++ |
|
80 ms |
1528 KB |
#include <queue>
#include "pizza.h"
#define inf 0x7fffffff
using namespace std;
queue <int> q[256];
int order_num, a[8], curr;
void Init()
{
order_num=curr=0;
}
void if_ok(void)
{
int i, mmin=inf, v=0, cnt, x;
for(i=curr ; i>0 ; i=(i-1)&curr)
{
if(!q[i].empty())
if(mmin>q[i].front())
{
mmin=q[i].front();
v=i;
}
}
if(v)
{
x=q[v].front();
Bake(x);
x=v;
i=1;
cnt=0;
while(i<=x)
{
if(i&x)
{
a[cnt]--;
if(a[cnt]==0)
curr-=i;
}
i=i<<1;
cnt++;
}
q[v].pop();
}
}
void Order(int N, int *A)
{
int i, x=0;
for(i=0 ; i<N ; i++)
x+=1<<A[i];
q[x].push(order_num++);
if_ok();
}
void Delivery(int I)
{
if(a[I]==0)
curr+=1<<I;
a[I]++;
if_ok();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1396 KB |
Output is correct |
2 |
Correct |
0 ms |
1396 KB |
Output is correct |
3 |
Correct |
0 ms |
1396 KB |
Output is correct |
4 |
Correct |
0 ms |
1396 KB |
Output is correct |
5 |
Correct |
0 ms |
1396 KB |
Output is correct |
6 |
Correct |
0 ms |
1396 KB |
Output is correct |
7 |
Correct |
0 ms |
1396 KB |
Output is correct |
8 |
Correct |
0 ms |
1396 KB |
Output is correct |
9 |
Correct |
0 ms |
1396 KB |
Output is correct |
10 |
Correct |
0 ms |
1396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1396 KB |
Output is correct |
2 |
Correct |
0 ms |
1396 KB |
Output is correct |
3 |
Correct |
4 ms |
1396 KB |
Output is correct |
4 |
Correct |
0 ms |
1396 KB |
Output is correct |
5 |
Correct |
0 ms |
1396 KB |
Output is correct |
6 |
Correct |
0 ms |
1396 KB |
Output is correct |
7 |
Correct |
0 ms |
1396 KB |
Output is correct |
8 |
Correct |
4 ms |
1396 KB |
Output is correct |
9 |
Correct |
0 ms |
1396 KB |
Output is correct |
10 |
Correct |
4 ms |
1396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
1396 KB |
Output is correct |
2 |
Correct |
76 ms |
1396 KB |
Output is correct |
3 |
Correct |
80 ms |
1396 KB |
Output is correct |
4 |
Correct |
76 ms |
1396 KB |
Output is correct |
5 |
Correct |
72 ms |
1528 KB |
Output is correct |
6 |
Correct |
72 ms |
1528 KB |
Output is correct |
7 |
Correct |
80 ms |
1396 KB |
Output is correct |
8 |
Correct |
80 ms |
1528 KB |
Output is correct |
9 |
Correct |
72 ms |
1396 KB |
Output is correct |
10 |
Correct |
68 ms |
1396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
1396 KB |
Output is correct |
2 |
Correct |
64 ms |
1396 KB |
Output is correct |
3 |
Correct |
56 ms |
1396 KB |
Output is correct |
4 |
Correct |
48 ms |
1396 KB |
Output is correct |
5 |
Correct |
56 ms |
1396 KB |
Output is correct |
6 |
Correct |
60 ms |
1396 KB |
Output is correct |
7 |
Correct |
60 ms |
1396 KB |
Output is correct |
8 |
Correct |
56 ms |
1396 KB |
Output is correct |
9 |
Correct |
60 ms |
1396 KB |
Output is correct |
10 |
Correct |
52 ms |
1396 KB |
Output is correct |