답안 #430175

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430175 2021-06-16T11:52:58 Z Mounir 최후의 만찬 (IOI12_supper) C++14
0 / 100
2500 ms 11060 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

const int N_BITS = 13;

void ComputeAdvice(int *C, int N, int K, int M) {
	for (int iVal = 0; iVal < N; ++iVal){
		int val = C[iVal];
		for (int i = 0; i < N_BITS; ++i)
			WriteAdvice((val&(1 << i)) > 0);
	}
}


#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;

const int N_BITS = 13;

void Assist(unsigned char *A, int N, int K, int R) {
	vector<int> C;
	for (int i  = 0; i < R; i += N_BITS){
		int tot = 0;
		for (int bit = 0; bit < N_BITS; ++bit)
			tot += A[i + bit] * (1 << bit);
		C.push_back(tot);
	}

	bool presents[N];
	for (int i = 0; i < N; ++i)
		presents[i] = false;
	for (int i = 0; i < K; ++i)
		presents[i] = true;

	for (int iReq = 0; iReq < N; ++iReq){
		int proc = GetRequest();

		if (!presents[proc]){
			int procUtil = -1, color = -1;
			for (int in = 0; in < N; ++in){
				if (!presents[in]) continue;
				int present = in;
				int ind = iReq + 1;
				while (ind < N && C[ind] != present)
					++ind;
				if (ind > procUtil){
					procUtil = ind;
					color = present;
				}
			}

			PutBack(color);
			presents[color] = false;
			presents[proc] = true;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 5 ms 712 KB Output is correct
4 Correct 19 ms 920 KB Output is correct
5 Correct 38 ms 1016 KB Output is correct
6 Correct 173 ms 1084 KB Output is correct
7 Correct 340 ms 1028 KB Output is correct
8 Execution timed out 2578 ms 1052 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2586 ms 1536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2515 ms 9068 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 484 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2576 ms 10944 KB Time limit exceeded
2 Execution timed out 2535 ms 10944 KB Time limit exceeded
3 Execution timed out 2511 ms 10956 KB Time limit exceeded
4 Execution timed out 2541 ms 11060 KB Time limit exceeded
5 Execution timed out 2513 ms 10920 KB Time limit exceeded
6 Execution timed out 2570 ms 10972 KB Time limit exceeded
7 Execution timed out 2548 ms 10904 KB Time limit exceeded
8 Execution timed out 2538 ms 10960 KB Time limit exceeded
9 Execution timed out 2531 ms 10952 KB Time limit exceeded
10 Execution timed out 2542 ms 10908 KB Time limit exceeded