Submission #430164

# Submission time Handle Problem Language Result Execution time Memory
430164 2021-06-16T11:49:57 Z Mounir Last supper (IOI12_supper) C++14
0 / 100
2500 ms 12044 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);
	}

	set<int> presents;
	for (int i = 0; i < K; ++i)
		presents.insert(i);

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

			PutBack(color);
			presents.erase(color);
			presents.insert(proc);
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 6 ms 772 KB Output is correct
4 Correct 13 ms 864 KB Output is correct
5 Correct 26 ms 1040 KB Output is correct
6 Correct 254 ms 1056 KB Output is correct
7 Correct 660 ms 1048 KB Output is correct
8 Execution timed out 2581 ms 1024 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2545 ms 1620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2590 ms 9476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 488 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2547 ms 11576 KB Time limit exceeded
2 Execution timed out 2534 ms 11872 KB Time limit exceeded
3 Execution timed out 2514 ms 11788 KB Time limit exceeded
4 Execution timed out 2525 ms 11936 KB Time limit exceeded
5 Execution timed out 2522 ms 12044 KB Time limit exceeded
6 Execution timed out 2522 ms 11852 KB Time limit exceeded
7 Execution timed out 2565 ms 11924 KB Time limit exceeded
8 Execution timed out 2589 ms 11820 KB Time limit exceeded
9 Execution timed out 2594 ms 11892 KB Time limit exceeded
10 Execution timed out 2593 ms 11884 KB Time limit exceeded