제출 #11129

#제출 시각아이디문제언어결과실행 시간메모리
11129gs14004올림픽 피자 (tutorial5)C++98
50 / 100
1000 ms2660 KiB
#include "pizza.h" #include <list> using namespace std; list<int> dq; list<int> num; int order_num; int ingredients[8], ingnow; void Init() { order_num = 0; } void deliver(){ list<int> ::iterator it = dq.begin(), it2 = num.begin(); while(it != dq.end()) { if(((*it) & ~ingnow) == 0){ Bake((*it2)); for (int j=0; j<8; j++) { if(((*it)>>j)&1){ ingredients[j]--; if(ingredients[j] == 0){ ingnow ^= (1<<j); } } } it = dq.erase(it); it2 = num.erase(it2); } else{ it++; it2++; } } } void Order(int N, int *A) { int bitfield = 0; for (int i=0; i<N; i++) { bitfield |= (1 << A[i]); } dq.push_back(bitfield); num.push_back(order_num++); deliver(); } void Delivery(int I) { ingredients[I]++; if(ingredients[I] == 1) ingnow |= (1<<I); deliver(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...