답안 #459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
459 2013-02-25T14:01:43 Z tncks0121 올림픽 피자 (tutorial5) C++
100 / 100
84 ms 1528 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 1396 KB Output is correct
2 Correct 0 ms 1396 KB Output is correct
3 Correct 0 ms 1396 KB Output is correct
4 Correct 0 ms 1396 KB Output is correct
5 Correct 0 ms 1396 KB Output is correct
6 Correct 0 ms 1396 KB Output is correct
7 Correct 0 ms 1396 KB Output is correct
8 Correct 0 ms 1396 KB Output is correct
9 Correct 0 ms 1396 KB Output is correct
10 Correct 0 ms 1396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1396 KB Output is correct
2 Correct 0 ms 1396 KB Output is correct
3 Correct 0 ms 1396 KB Output is correct
4 Correct 0 ms 1396 KB Output is correct
5 Correct 0 ms 1396 KB Output is correct
6 Correct 0 ms 1396 KB Output is correct
7 Correct 0 ms 1396 KB Output is correct
8 Correct 0 ms 1396 KB Output is correct
9 Correct 0 ms 1396 KB Output is correct
10 Correct 0 ms 1396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 1396 KB Output is correct
2 Correct 84 ms 1396 KB Output is correct
3 Correct 80 ms 1396 KB Output is correct
4 Correct 84 ms 1396 KB Output is correct
5 Correct 84 ms 1528 KB Output is correct
6 Correct 72 ms 1528 KB Output is correct
7 Correct 76 ms 1396 KB Output is correct
8 Correct 84 ms 1528 KB Output is correct
9 Correct 84 ms 1396 KB Output is correct
10 Correct 84 ms 1396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 1396 KB Output is correct
2 Correct 48 ms 1396 KB Output is correct
3 Correct 56 ms 1396 KB Output is correct
4 Correct 52 ms 1396 KB Output is correct
5 Correct 56 ms 1396 KB Output is correct
6 Correct 52 ms 1396 KB Output is correct
7 Correct 52 ms 1396 KB Output is correct
8 Correct 60 ms 1396 KB Output is correct
9 Correct 56 ms 1396 KB Output is correct
10 Correct 52 ms 1396 KB Output is correct