답안 #27409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27409 2017-07-12T12:31:41 Z boh7978 올림픽 피자 (tutorial5) C++14
70 / 100
1000 ms 5024 KB
#include "pizza.h"

int order_num;
int elm[9];
int customer[100111][10]; //8: N 9:able

void Init() {

	order_num = 0;
	for (int j = 0; j < 100111; j++) {
		for (int i = 0; i < 10; i++) {
			elm[i] = 0;
			if (customer[j][9] != 0) {
				customer[j][i] = 0;
			}
		}
	}
}

void Order(int N, int *A) {

	bool ready = true;
	for (int i = 0; i < N; i++) {
		if (elm[A[i]] == 0) { ready = false; break; }
	}
	if (ready) {
		Bake(order_num);
		for (int i = 0; i < N; i++) {
			elm[A[i]]--;
		}
	}
	else {
		customer[order_num][9] = 1;
		customer[order_num][8] = N;
		for (int i = 0; i < N; i++) {
			customer[order_num][i] = A[i];
		}
	}
	order_num++;

}

void Delivery(int I) {
	elm[I]++;
	for (int c = 0; c < order_num; c++) {
		bool ready = true;
		if (customer[c][9]) {
			for (int i = 0; i < customer[c][8]; i++) {
				if (elm[customer[c][i]] == 0) { ready = false; break; }
			}
			if (ready) {
				customer[c][9] = 0;
				for (int i = 0; i < customer[c][8]; i++) {
					elm[customer[c][i]]--;
				}
				Bake(c);
				break;
			}
		}
	}

}

Compilation message

grader.cpp: In function 'int main(int, char**)':
grader.cpp:65:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
tutorial5.cpp: In function 'void Init()':
tutorial5.cpp:13:14: warning: iteration 9u invokes undefined behavior [-Waggressive-loop-optimizations]
    elm[i] = 0;
              ^
tutorial5.cpp:12:21: note: containing loop
   for (int i = 0; i < 10; i++) {
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5024 KB Output is correct
2 Correct 0 ms 5024 KB Output is correct
3 Correct 0 ms 5024 KB Output is correct
4 Correct 0 ms 5024 KB Output is correct
5 Correct 0 ms 5024 KB Output is correct
6 Correct 0 ms 5024 KB Output is correct
7 Correct 3 ms 5024 KB Output is correct
8 Correct 0 ms 5024 KB Output is correct
9 Correct 0 ms 5024 KB Output is correct
10 Correct 0 ms 5024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 5024 KB Output is correct
2 Correct 26 ms 5024 KB Output is correct
3 Correct 29 ms 5024 KB Output is correct
4 Correct 26 ms 5024 KB Output is correct
5 Correct 29 ms 5024 KB Output is correct
6 Correct 23 ms 5024 KB Output is correct
7 Correct 26 ms 5024 KB Output is correct
8 Correct 23 ms 5024 KB Output is correct
9 Correct 23 ms 5024 KB Output is correct
10 Correct 26 ms 5024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 5024 KB Output is correct
2 Correct 56 ms 5024 KB Output is correct
3 Correct 43 ms 5024 KB Output is correct
4 Correct 63 ms 5024 KB Output is correct
5 Correct 46 ms 5024 KB Output is correct
6 Correct 53 ms 5024 KB Output is correct
7 Correct 39 ms 5024 KB Output is correct
8 Correct 53 ms 5024 KB Output is correct
9 Correct 39 ms 5024 KB Output is correct
10 Correct 36 ms 5024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 5024 KB Execution timed out
2 Halted 0 ms 0 KB -