답안 #753617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
753617 2023-06-05T14:48:21 Z minhcool 최후의 만찬 (IOI12_supper) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define int long long
#define fi first
#define se second
#define pb push_back
//#define mp make_pair
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
 
const int N = 3e5 + 5;
 
const int oo = 1e18 + 7, mod = 1e9 + 7;
 
mt19937 rng(1);
 
int rnd(int l, int r){
	int temp = rng() % (r - l + 1);
	return abs(temp) + l;
}
 
//set<ii> se;
 
map<int, int> mp;
 
int nxt[N];
 
int c[N];
 
bool cook[N];
int in[N];

int n, k;
 
void ComputeAdvice(int *C, int N, int K, int M){
  n = N, k = K;
	for(int i = 0; i < k; i++) c[i] = i;
	for(int i = k; i < n + k; i++) c[i] = C[i - k];
	for(int i = n + k - 1; i >= 0; i--){
		if(mp.find(c[i]) == mp.end()) nxt[i] = oo;
		else nxt[i] = mp[c[i]];
		mp[c[i]] = i;
	}
	set<ii> se;
	for(int i = 0; i < n; i++) in[i] = -1;
	for(int i = 0; i < n + k; i++){
		if(in[c[i]] >= 0){
			se.erase({in[c[i]], c[i]});
			in[c[i]] = nxt[i];
			se.insert({in[c[i]], c[i]});
		}
		else{
			if(se.size() == k){
				int temp = (*se.rbegin()).se;
				cook[temp] = 1;
				in[temp] = -1;
				se.erase((*se.rbegin()));
			}
			in[c[i]] = nxt[i];
			se.insert({in[c[i]], c[i]});
		}
	}
	for(int i = 0; i < n + k; i++) WriteAdvice(cook[i]); 
}
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int N = 3e5 + 5;

const int oo = 1e18 + 7, mod = 1e9 + 7;

mt19937 rng(1);

int rnd(int l, int r){
	int temp = rng() % (r - l + 1);
	return abs(temp) + l;
}


void Assist(unsigned char *A, int N, int K, int R){
	int n = N, k = K;
	set<int> cooking;
	set<int> ins;
	//for(int i = 0; i < n; i++) in[i] = -1;
	for(int i = 0; i < n + k; i++){
		int x = GetRequest();
		if(ins.find(x) != ins.end()){
			cooking.erase(x);
			if(A[i]) cooking.insert(x);
		}
		else{
			int temp = (*cooking.begin());
			cooking.erase(temp);
			ins.erase(temp);
			PutBack(temp);
			if(A[i]) cooking.insert(x);
			ins.insert(x);
		}
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(long long int*, long long int, long long int, long long int)':
advisor.cpp:58:17: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   58 |    if(se.size() == k){
      |                 ^
advisor.cpp:68:33: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   68 |  for(int i = 0; i < n + k; i++) WriteAdvice(cook[i]);
      |                                 ^~~~~~~~~~~
      |                                 ComputeAdvice

assistant.cpp: In function 'void Assist(unsigned char*, long long int, long long int, long long int)':
assistant.cpp:34:11: error: 'GetRequest' was not declared in this scope
   34 |   int x = GetRequest();
      |           ^~~~~~~~~~
assistant.cpp:43:4: error: 'PutBack' was not declared in this scope
   43 |    PutBack(temp);
      |    ^~~~~~~