Submission #14862

# Submission time Handle Problem Language Result Execution time Memory
14862 2015-07-01T15:33:50 Z pichulia 올림픽 피자 (tutorial5) C++
100 / 100
87 ms 1480 KB
#include"pizza.h"
#include<vector>
using namespace std;
#define I 131072
static int order_num;
static int a[8];
static vector<int> b[256];
void Init() {
 
  order_num = 0;
  int i, j;
  for(i=0; i<8; i++)
      a[i] = 0;
  for(i=0;i<256;i++)
	  b[i].clear();
}
void check()
{
	int i, j, k;
	for(i=j=0;i<8;i++)
		if(a[i])
			j += (1<<i);
	int ti,tm;
	ti = -1;
	for(i=j;i;i=(i-1)&j)
	{
		if(b[i].size() == 0)continue;
		if(ti<0 || tm>b[i][0])
		{
			ti = i;
			tm = b[i][0];
		}
	}
	if(ti<0)return;
	Bake(tm);
	for(i=0;i<8;i++)
		if(ti&(1<<i))
			a[i]--;
	b[ti].erase(b[ti].begin());
}
void Order(int N, int *A) {
 
    int i, j, k=0;
	j=0;
	for(i=0;i<N;i++)
		k += (1<<A[i]);
	for(i=0;i<8;i++)
		if(a[i])
			j += (1<<i);
	b[k].push_back(order_num);
    order_num++;
	check();
}
void Delivery(int x) {
    a[x]++;
	check();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1216 KB Output is correct
2 Correct 0 ms 1216 KB Output is correct
3 Correct 0 ms 1216 KB Output is correct
4 Correct 0 ms 1216 KB Output is correct
5 Correct 0 ms 1216 KB Output is correct
6 Correct 0 ms 1216 KB Output is correct
7 Correct 0 ms 1216 KB Output is correct
8 Correct 0 ms 1216 KB Output is correct
9 Correct 0 ms 1216 KB Output is correct
10 Correct 0 ms 1216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1216 KB Output is correct
2 Correct 4 ms 1216 KB Output is correct
3 Correct 2 ms 1216 KB Output is correct
4 Correct 0 ms 1216 KB Output is correct
5 Correct 3 ms 1216 KB Output is correct
6 Correct 1 ms 1216 KB Output is correct
7 Correct 3 ms 1216 KB Output is correct
8 Correct 3 ms 1216 KB Output is correct
9 Correct 0 ms 1216 KB Output is correct
10 Correct 3 ms 1216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 85 ms 1348 KB Output is correct
2 Correct 81 ms 1348 KB Output is correct
3 Correct 82 ms 1348 KB Output is correct
4 Correct 73 ms 1348 KB Output is correct
5 Correct 77 ms 1480 KB Output is correct
6 Correct 79 ms 1480 KB Output is correct
7 Correct 87 ms 1216 KB Output is correct
8 Correct 77 ms 1480 KB Output is correct
9 Correct 70 ms 1348 KB Output is correct
10 Correct 79 ms 1216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 1348 KB Output is correct
2 Correct 60 ms 1372 KB Output is correct
3 Correct 58 ms 1372 KB Output is correct
4 Correct 64 ms 1368 KB Output is correct
5 Correct 56 ms 1372 KB Output is correct
6 Correct 66 ms 1348 KB Output is correct
7 Correct 60 ms 1348 KB Output is correct
8 Correct 62 ms 1376 KB Output is correct
9 Correct 60 ms 1348 KB Output is correct
10 Correct 55 ms 1348 KB Output is correct