Submission #13902

# Submission time Handle Problem Language Result Execution time Memory
13902 2015-04-18T10:06:02 Z minsu 올림픽 피자 (tutorial5) C++14
0 / 100
26 ms 1592 KB
#include "pizza.h"

#include <queue>
#include <algorithm>
using namespace std;
const int INF=987654321;
queue<int> pizza[1<<7];
int on=0,cnt[7];
void Init(){
	
}
void chk(){
	int avpiz=0, minnum=INF, minq;
	for(int i=0;i<7;i++)
		if(cnt[i]) avpiz|=1<<i;
	for(int i=0;i<1<<7;i++){
		if(i - (i & avpiz) == 0 && !pizza[i].empty()){
			if(minnum>pizza[i].front()){
				minnum=pizza[i].front();
				minq=i;
			}
		}
	}
	if(minnum!=INF){
		Bake(minnum); pizza[minq].pop();
		for(int i=0;i<7;i++)
			if(minq & (1<<i)){
				cnt[i]--;
			}
	}
}
void Order(int N, int *A){
	int nowpiz=0;
	for(int i=0;i<N;i++)
		nowpiz|=1<<(A[i]-1);
	pizza[nowpiz].push(on++);
	chk();
}
void Delivery(int I){
	cnt[I-1]++;
	chk();
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1592 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1588 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 26 ms 1588 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1588 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -