답안 #761845

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
761845 2023-06-20T10:25:06 Z SanguineChameleon 최후의 만찬 (IOI12_supper) C++17
0 / 100
101 ms 13368 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

const int maxN = 1e5 + 20;
vector<int> pos[maxN];
int A[maxN * 2];

void ComputeAdvice(int *C, int N, int K, int M) {
	for (int i = N - 1; i >= 0; i--) {
		pos[C[i]].push_back(i);
	}
	set<pair<int, int>> S;
	for (int i = 0; i < K; i++) {
		S.emplace(pos[i].empty() ? N : 0, i);
	}
	for (int i = 0; i < N; i++) {
		if (S.begin()->first == i) {
			S.erase(S.begin());
		}
		else {
			A[prev(S.end())->second] = 1;
			S.erase(prev(S.end()));
		}
		pos[C[i]].pop_back();
		S.emplace(pos[C[i]].empty() ? N : 0, K + i);
	}
	for (int i = 0; i < K + N; i++) {
		WriteAdvice(A[i]);
	}
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;

const int maxK = 1e5 + 20;
int flag[maxK];

void Assist(unsigned char *A, int N, int K, int R) {
	set<int> free;
	set<int> S;
	for (int i = 0; i < K; i++) {
		if (A[i] == 1) {
			free.insert(i);
		}
		S.insert(i);
	}
	for (int i = 0; i < N; i++) {
		int X = GetRequest();
		if (S.find(X) == S.end()) {
			int Y = *free.begin();
			PutBack(Y);
			free.erase(Y);
			S.erase(Y);
			S.insert(X);
		}
		if (flag[X] == 0 && A[K + i] == 1) {
			free.insert(X);
		}
		if (flag[X] == 1 && A[K + i] == 0) {
			free.erase(X);
		}
		flag[X] = A[K + i];
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2952 KB Output is correct
2 Incorrect 2 ms 2968 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 3844 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 76 ms 9824 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3264 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 96 ms 10920 KB Output isn't correct - not an optimal way
2 Incorrect 94 ms 11336 KB Output isn't correct - not an optimal way
3 Incorrect 96 ms 11816 KB Output isn't correct - not an optimal way
4 Incorrect 97 ms 11752 KB Output isn't correct - not an optimal way
5 Incorrect 98 ms 11704 KB Output isn't correct - not an optimal way
6 Incorrect 99 ms 11796 KB Output isn't correct - not an optimal way
7 Incorrect 96 ms 11732 KB Output isn't correct - not an optimal way
8 Incorrect 101 ms 11980 KB Output isn't correct - not an optimal way
9 Incorrect 95 ms 11692 KB Output isn't correct - not an optimal way
10 Incorrect 94 ms 13368 KB Output isn't correct - not an optimal way