Submission #14505

# Submission time Handle Problem Language Result Execution time Memory
14505 2015-05-19T00:54:45 Z nosiar 올림픽 피자 (tutorial5) C++14
50 / 100
1000 ms 1600 KB
#include <vector>
#include <cstring>
#include <utility>
#include "pizza.h"
using namespace std;
vector<pair<int, int>> orders;
int ingred[8];
int order_num;
void Init() {
  memset(ingred, 0, sizeof(ingred));
  orders.clear();
  order_num =0;
}
void _Bake()
{
	for(auto it = orders.begin(); it != orders.end(); ++it)
	{
		bool succ= true;
		for(int i = 0 ; i< 8; ++i)
		{
			if((it->second >> i)&1)
			{
				if(!ingred[i])
				{
					succ = false;
					break;
				}
			}
		}
		if(succ)
		{
			for(int i = 0 ; i< 8; ++i)
			{
				if((it->second >> i)&1)
				{
					ingred[i]--;
				}
			}
			Bake(it->first);
			orders.erase(it);
			return;			
		}
	}
}
void Order(int N, int *A) {

int ing = 0; 
for(int i = 0; i < N; ++i)
{
	ing |= 1<<A[i];
}
orders.push_back({order_num, ing});
order_num++;
_Bake();

}

void Delivery(int I) {
ingred[I]++;
_Bake();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1208 KB Output is correct
2 Correct 0 ms 1208 KB Output is correct
3 Correct 0 ms 1208 KB Output is correct
4 Correct 0 ms 1208 KB Output is correct
5 Correct 0 ms 1208 KB Output is correct
6 Correct 0 ms 1208 KB Output is correct
7 Correct 0 ms 1208 KB Output is correct
8 Correct 0 ms 1208 KB Output is correct
9 Correct 0 ms 1208 KB Output is correct
10 Correct 0 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1208 KB Output is correct
2 Correct 21 ms 1208 KB Output is correct
3 Correct 23 ms 1208 KB Output is correct
4 Correct 20 ms 1208 KB Output is correct
5 Correct 22 ms 1208 KB Output is correct
6 Correct 25 ms 1208 KB Output is correct
7 Correct 28 ms 1208 KB Output is correct
8 Correct 24 ms 1208 KB Output is correct
9 Correct 21 ms 1208 KB Output is correct
10 Correct 19 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1600 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1340 KB Program timed out
2 Halted 0 ms 0 KB -