Submission #599

# Submission time Handle Problem Language Result Execution time Memory
599 2013-02-28T15:02:07 Z gs13068 올림픽 피자 (tutorial5) C++
100 / 100
111 ms 1220 KB
#include"pizza.h"
#include<vector>

void Init(){}

std::vector<int> v[256];
int f[256];

int ordern;

int jaeryo[8];
int can;

void Order(int n,int *a)
{
  bool flag;
  int i,j=0,min;
  for(i=0;i<n;i++)j|=1<<a[i];
  v[j].push_back(ordern++);
 
  do
  {
    min=-1;
    flag=false;
    for(i=1;i<256;i++)
    {
      if((i&can)!=i)continue;
      if(f[i]<v[i].size()&&(min==-1||v[i][f[i]]<v[min][f[min]]))
      {
        flag=true;
        min=i;
      }
    }
    if(flag)
    {
      Bake(v[min][f[min]]);
      f[min]++;
      for(i=0;i<8;i++)
      {
        if(min&(1<<i))
        {
          jaeryo[i]--;
          if(jaeryo[i]==0)
          	can^=1<<i;
        }
      }
    }
  }while(flag);
}

void Delivery(int x)
{
  int i,min;
  bool flag;
  if(jaeryo[x]==0)can|=1<<x;
  jaeryo[x]++;
  
  do
  {
    min=-1;
    flag=false;
    for(i=1;i<256;i++)
    {
      if((i&can)!=i)continue;
      if(f[i]<v[i].size()&&(min==-1||v[i][f[i]]<v[min][f[min]]))
      {
        flag=true;
        min=i;
      }
    }
    if(flag)
    {
      Bake(v[min][f[min]]);
      f[min]++;
      for(i=0;i<8;i++)
      {
        if(min&(1<<i))
        {
          jaeryo[i]--;
          if(jaeryo[i]==0)
          	can^=1<<i;
        }
      }
    }
  }while(flag);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 948 KB Output is correct
2 Correct 0 ms 948 KB Output is correct
3 Correct 0 ms 948 KB Output is correct
4 Correct 0 ms 948 KB Output is correct
5 Correct 0 ms 948 KB Output is correct
6 Correct 0 ms 948 KB Output is correct
7 Correct 0 ms 948 KB Output is correct
8 Correct 0 ms 948 KB Output is correct
9 Correct 0 ms 948 KB Output is correct
10 Correct 0 ms 948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 948 KB Output is correct
2 Correct 4 ms 948 KB Output is correct
3 Correct 5 ms 948 KB Output is correct
4 Correct 5 ms 948 KB Output is correct
5 Correct 4 ms 948 KB Output is correct
6 Correct 4 ms 948 KB Output is correct
7 Correct 5 ms 948 KB Output is correct
8 Correct 4 ms 948 KB Output is correct
9 Correct 4 ms 948 KB Output is correct
10 Correct 3 ms 948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 1080 KB Output is correct
2 Correct 98 ms 1212 KB Output is correct
3 Correct 98 ms 1080 KB Output is correct
4 Correct 99 ms 1212 KB Output is correct
5 Correct 100 ms 1212 KB Output is correct
6 Correct 99 ms 1220 KB Output is correct
7 Correct 106 ms 1080 KB Output is correct
8 Correct 111 ms 1212 KB Output is correct
9 Correct 93 ms 1212 KB Output is correct
10 Correct 95 ms 1080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 1212 KB Output is correct
2 Correct 94 ms 1212 KB Output is correct
3 Correct 91 ms 1212 KB Output is correct
4 Correct 95 ms 1212 KB Output is correct
5 Correct 93 ms 1212 KB Output is correct
6 Correct 94 ms 1212 KB Output is correct
7 Correct 91 ms 1212 KB Output is correct
8 Correct 93 ms 1212 KB Output is correct
9 Correct 96 ms 1216 KB Output is correct
10 Correct 88 ms 1212 KB Output is correct