답안 #3232

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3232 2013-08-29T09:16:19 Z pichulia 올림픽 피자 (tutorial5) C++
70 / 100
1000 ms 1984 KB
#include "pizza.h"
#include <vector>

using namespace std;

static int order_num;
static int a[8];
struct A{
	int i,d;
};
static vector<A> b;
void Init() {

  order_num = 0;
  int i, j;
  for(i=0; i<8; i++)
	  a[i] = 0;
}
bool able(int x)
{
	int i, j;
	j=1;
	for(i=0;i<8;i++)
	{
		if(x&j)
		{
			if(a[i]==0)
				return false;
		}
		j*=2;
	}
	j=1;
	for(i=0;i<8;i++)
	{
		if(x&j)
		{
			a[i]--;
		}
		j*=2;
	}
	return true;
}
void check(int mod)
{
	int i, j;
	int n = b.size();

	if(mod == 0)
		i = n - 1;
	else
		i = 0;
	for(;i<n;i++)
	{
		if(able(b[i].d))
		{
			Bake(b[i].i);
			b.erase(b.begin() + i);
			i--;
			n--;
		}
	}
}
void Order(int N, int *A) {

	int i, j, k=0;
	j=1;
	for(i=0;i<8;i++)
	{
		int ii;
		for(ii=0;ii<N;ii++)
		{
			if(A[ii] == i)
				break;
		}
		if(ii<N)
			k+=j;
		j*=2;
	}
	struct A c;
	c.d = k;
	c.i = order_num;
	b.push_back(c);
	order_num++;

	check(0);
}

void Delivery(int I) {

	a[I]++;
	check(1);
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1208 KB Output is correct
2 Correct 16 ms 1208 KB Output is correct
3 Correct 16 ms 1208 KB Output is correct
4 Correct 16 ms 1208 KB Output is correct
5 Correct 16 ms 1208 KB Output is correct
6 Correct 16 ms 1208 KB Output is correct
7 Correct 20 ms 1208 KB Output is correct
8 Correct 12 ms 1208 KB Output is correct
9 Correct 12 ms 1208 KB Output is correct
10 Correct 16 ms 1208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1600 KB Output is correct
2 Correct 48 ms 1984 KB Output is correct
3 Correct 48 ms 1600 KB Output is correct
4 Correct 48 ms 1984 KB Output is correct
5 Correct 56 ms 1984 KB Output is correct
6 Correct 60 ms 1984 KB Output is correct
7 Correct 44 ms 1340 KB Output is correct
8 Correct 60 ms 1984 KB Output is correct
9 Correct 44 ms 1600 KB Output is correct
10 Correct 40 ms 1340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 1340 KB Program timed out
2 Halted 0 ms 0 KB -