Submission #18971

# Submission time Handle Problem Language Result Execution time Memory
18971 2016-02-16T18:33:49 Z dltldls95 올림픽 피자 (tutorial5) C++
0 / 100
1000 ms 4600 KB
#include "pizza.h"
#include <cstring>
#define C(a) memset((a),0,sizeof(a))
#define N 100010
int order[N][8];
int ordered[N];
//int foodorder[8][N];
//vector<int> foods[8];
//queue<int> orders;
int firstorder = -1;
int lastorder = -1;
int currentFood[8];
void Init()
{
  C(order);
  C(ordered);
  
}
void CheckAll()
{
  for (int i = firstorder; i <= lastorder; i++)
  {
    if (!ordered[i])
      continue;
    bool bakable = true;
    for (int j = 0; j < 8; j++)
    {
      if (order[i][j] == 1 && currentFood[j] == 0)
      {
        bakable = false;
        break;
      }
      
    }
    if (bakable)
    {
      
      Bake(i);
      ordered[i] = 0;
      for (int j = 0; j < 8; j++)
      {
        if (order[i][j])
        {
          currentFood[j]--;
          
        }
        
      }
      if (i > firstorder)
      {
        firstorder++;
        //debug(firstorder);
        /*for (int j = i + 1; j < N; j++)
        {
        if (ordered[j])
        {
        firstorder = j;
        debug(firstorder);
        break;
        }
        }*/
      }
    }
    
  }
}
void Order(int n, int* a)
{
  if (firstorder == -1)
    firstorder = 0;
  
  lastorder++;
  ordered[lastorder] = 1;
  for (int i = 0; i < n; i++)
  {
    //foods[lastorder].push_back(a[i]);
    order[lastorder][a[i]]++;
    
    
  }
  CheckAll();
}
void Delivery(int l)
{
  currentFood[l]++;
  CheckAll();
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 4600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 4600 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 4600 KB Program timed out
2 Halted 0 ms 0 KB -