# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
14507 |
2015-05-19T01:28:04 Z |
nosiar |
올림픽 피자 (tutorial5) |
C++14 |
|
14 ms |
1584 KB |
#include <queue>
#include <cstring>
#include <utility>
#include "pizza.h"
using namespace std;
queue<int> orders[64];
int ingred[8];
int order_num;
void Init() {
memset(ingred, 0, sizeof(ingred));
for(int i = 0 ; i < 64; ++i)
queue<int>().swap(orders[i]);
order_num =0;
}
bool asdf(int ing)
{
bool succ= true;
for(int i = 0 ; i< 8; ++i)
{
if((ing >> i)&1)
{
if(!ingred[i])
{
succ = false;
break;
}
}
}
return succ;
}
void asdf2(int ing)
{
{
for(int i = 0 ; i< 8; ++i)
{
if((ing >> i)&1)
{
ingred[i]--;
}
}
}
}
void Order(int N, int *A) {
int ing = 0;
for(int i = 0; i < N; ++i)
{
ing |= 1<<A[i];
}
if(asdf(ing))
{
asdf2(ing);
Bake(order_num);
}
else
orders[ing].push(order_num);
order_num++;
}
void Delivery(int I) {
ingred[I]++;
int min_i=-1;
int min_order_num = 987654321;
for(int i = 0 ; i < 64; ++i)
{
if(!orders[i].empty() && asdf(i))
{
if(orders[i].front() < min_order_num)
{
min_order_num = orders[i].front();
min_i = i;
}
}
}
if(min_i != -1)
{
Bake(orders[min_i].front());
orders[min_i].pop();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1580 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1580 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
14 ms |
1584 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1580 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |