답안 #1015610

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015610 2024-07-06T15:17:11 Z parsadox2 최후의 만찬 (IOI12_supper) C++17
0 / 100
71 ms 13568 KB
#include <bits/stdc++.h>
#include "advisor.h"

#define F first
#define S second

using namespace std;

const int N = 1e5 + 10;

int n , m , k , ar[N] , las[N];
vector <int> pos[N];
bool B[N << 1];

void ComputeAdvice(int *C, int nn, int kk, int mm){
	n = nn;
	m = mm;
	k = kk;
	for(int i = 0 ; i < n ; i++)
	{
		ar[i] = C[i];
		pos[i].push_back(n + 1);
	}
	for(int i = n - 1 ; i >= 0 ; i--)
		pos[ar[i]].push_back(i);
	set <pair <int , int>> st;
	for(int i = 0 ; i < k ; i++)
	{
		las[i] = i;
		st.insert(make_pair(pos[i].back() , i));
	}
	for(int i = 0 ; i < n ; i++)
	{
		int x = ar[i];
		auto it = st.find(make_pair(i , x));
		if(it != st.end())
		{
			st.erase(it);
			pos[x].pop_back();
			las[x] = i + k;
			st.insert(make_pair(pos[x].back() , x));
		}
		else
		{
			auto rem = st.end();  rem--;
			auto now = *rem;
			B[las[now.S]] = 1;
			st.erase(rem);
			pos[x].pop_back();
			las[x] = i + k;
			st.insert(make_pair(pos[x].back() , x));
		}
	}
	for(int i = 0 ; i < n + k ; i++)
		WriteAdvice(B[i]);
}
#include <bits/stdc++.h>
#include "assistant.h"
 
#define F first
#define S second

using namespace std;

const int N = 1e5 + 10;

int n2 , k2 , r2;

void Assist(unsigned char *ar, int nn, int kk, int rr) {
	n2 = nn;
	k2 = kk;
	r2 = rr;
	set <int> st;
	for(int i = 0 ; i < k2 ; i++)
		st.insert(i);
	vector <int> vec;
	for(int i = 0 ; i < k2 ; i++)  if(ar[i])
		vec.push_back(i);
	for(int i = k2 ; i < k2 + n2 ; i++)
	{
		int now = GetRequest();
		if(st.find(now) == st.end())
		{
			PutBack(vec.back());
			vec.pop_back();
		}
		if(ar[i])
			vec.push_back(now);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 3096 KB Output is correct
2 Incorrect 1 ms 3096 KB Error - Putting back a color when it is already on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3852 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 11652 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 3400 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 68 ms 12856 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 60 ms 13284 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 62 ms 13544 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 60 ms 13376 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 61 ms 13384 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 59 ms 13476 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 65 ms 13568 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 65 ms 13548 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 71 ms 13376 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 62 ms 13380 KB Error - Putting back a color when it is already on the scaffold