Submission #1166

# Submission time Handle Problem Language Result Execution time Memory
1166 2013-06-28T13:13:49 Z kriii 올림픽 피자 (tutorial5) C++
20 / 100
53 ms 1096 KB
#include "pizza.h"
#include <queue>
using namespace std;

int ing[8],have,ordernumber;
queue<int> orderlist[1<<8];

void Init(){
	int i;

	for (i=0;i<(1<<8);i++) while (!orderlist[i].empty()) orderlist[i].pop();
	for (i=0;i<8;i++) ing[i] = 0;
	have = ordernumber = 0;
}

void Order(int N, int *A) {
	int what = 0, i;

	for (i=0;i<N;i++) what += 1 << A[i];

	if ((have & what) == what){
		for (i=0;i<N;i++){
			if (--ing[A[i]] == 0) have -= 1 << A[i];
		}
		Bake(ordernumber);
	}
	else orderlist[what].push(ordernumber);
	ordernumber++;
}

void Delivery(int I) {
	int i,num=ordernumber,x;

	if (ing[I]++ == 0){
		have += 1 << I;
		
		for (i=have;i;i=have&(i-1)){
			if (!orderlist[i].empty()){
				if (num > orderlist[i].front()){
					num = orderlist[i].front();
					x = i;
				}
			}
		}
		if (num < ordernumber){
			for (i=0;i<8;i++) if (num | (1 << i)){
				if (--ing[i] == 0) have -= 1 << i;
			}
			Bake(num);
			orderlist[x].pop();
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1096 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 1096 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 Correct 44 ms 1096 KB Output is correct
2 Correct 50 ms 1096 KB Output is correct
3 Correct 44 ms 1096 KB Output is correct
4 Correct 51 ms 1096 KB Output is correct
5 Correct 49 ms 1096 KB Output is correct
6 Correct 53 ms 1096 KB Output is correct
7 Correct 39 ms 1096 KB Output is correct
8 Correct 51 ms 1096 KB Output is correct
9 Correct 45 ms 1096 KB Output is correct
10 Correct 37 ms 1096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1096 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 -