답안 #1084

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084 2013-06-24T18:27:09 Z tncks0121 올림픽 피자 (tutorial5) C++
100 / 100
95 ms 1228 KB
#include "pizza.h"
#include <queue>

using namespace std;

queue<int> Q[256];
int ORD;
int ing[10], ings;

void Init(){
	ORD = 0;
}

void check (){
	int state, f, i;
	while(1) {
		f = -1;
		for(state = ings; state > 0; state = (state - 1) & ings){
			if( !Q[state].empty() && (f < 0 || Q[f].front() > Q[state].front()) ) f = state;
		}
		if(f < 0) return; 
		Bake(Q[f].front()); Q[f].pop();
		for(i = 0; i < 8; i++) if(f & (1 << i)) {
			if(--ing[i] == 0) ings ^= (1 << i);
		}
	}
}

void Order (int N, int *A) {
	int a = 0, i;
	for(i = 0; i < N; i++) a |= (1 << A[i]);
	Q[a].push (ORD++);
	check();
}

void Delivery (int I){
	if(++ing[I] == 1) ings |= (1 << I);
	check();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1096 KB Output is correct
2 Correct 0 ms 1096 KB Output is correct
3 Correct 0 ms 1096 KB Output is correct
4 Correct 0 ms 1096 KB Output is correct
5 Correct 0 ms 1096 KB Output is correct
6 Correct 0 ms 1096 KB Output is correct
7 Correct 0 ms 1096 KB Output is correct
8 Correct 0 ms 1096 KB Output is correct
9 Correct 0 ms 1096 KB Output is correct
10 Correct 0 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1096 KB Output is correct
2 Correct 2 ms 1096 KB Output is correct
3 Correct 1 ms 1096 KB Output is correct
4 Correct 0 ms 1096 KB Output is correct
5 Correct 2 ms 1096 KB Output is correct
6 Correct 3 ms 1096 KB Output is correct
7 Correct 3 ms 1096 KB Output is correct
8 Correct 1 ms 1096 KB Output is correct
9 Correct 1 ms 1096 KB Output is correct
10 Correct 2 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 1096 KB Output is correct
2 Correct 92 ms 1096 KB Output is correct
3 Correct 91 ms 1096 KB Output is correct
4 Correct 85 ms 1096 KB Output is correct
5 Correct 88 ms 1228 KB Output is correct
6 Correct 88 ms 1228 KB Output is correct
7 Correct 91 ms 1096 KB Output is correct
8 Correct 89 ms 1228 KB Output is correct
9 Correct 91 ms 1096 KB Output is correct
10 Correct 95 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 1096 KB Output is correct
2 Correct 53 ms 1096 KB Output is correct
3 Correct 55 ms 1096 KB Output is correct
4 Correct 60 ms 1096 KB Output is correct
5 Correct 61 ms 1096 KB Output is correct
6 Correct 55 ms 1096 KB Output is correct
7 Correct 57 ms 1096 KB Output is correct
8 Correct 59 ms 1096 KB Output is correct
9 Correct 58 ms 1096 KB Output is correct
10 Correct 55 ms 1096 KB Output is correct