답안 #349632

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
349632 2021-01-18T05:00:43 Z amunduzbaev 최후의 만찬 (IOI12_supper) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

#ifndef EVAL
#include "grader.cpp"
#endif
#include "assistant.h"

using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vll vector<ll>
#define vii vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define cnt(a)__builtin_popcount(a)
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
 
const int NN = 1e6+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);
int a[NN], used[NN], fir[NN];

void ComputeAdvice(int *c, int n, int k, int m){
	memset(used, mod, sizeof used);
	for(int i=n-1;i>=0;i--){
		a[i] = used[c[i]];
		if(used[c[i]] == mod) fir[c[i]] = i;
		used[c[i]] = i;
	}
	set<pii> ss;
	for(int i=0;i<k;i++){
		ss.insert({fir[i], i});
	}
	
	for(int i=0;i<n;i++){
		auto tmp = ss.find({i, c[i]});
		if(tmp != ss.end()) { WriteAdvice(1); continue; }
		else WriteAdvice(0);
		
		auto cur = --ss.end();
		ss.erase(cur);
		int l = 0, r = k-1;
		int need = (*cur).ss, cnt = 0;
		
		while(l < r){
			cnt++;
			int m = (l + r +1)>>1;
			if(m >= need) { WriteAdvice(0); l = m; }
			else { WriteAdvice(1); r = m-1; }
		}
		ss.insert({a[i], need});
	}
}
#include <bits/stdc++.h>

#ifndef EVAL
#include "grader.cpp"
#endif
#include "assistant.h"

using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vll vector<ll>
#define vii vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define cnt(a)__builtin_popcount(a)
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
 
const int NN = 1e6+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);
//int used;
void Assist(unsigned char *a, int n, int k, int r) {
	int last = 0;
	for(int i=0;i<n;i++){
		GetRequest();
		if(a[last]) continue;
		int l = 0, r = k-1;
		while(l < r){
			int m = (l + r +1)>>1;
			if(a[last]) r = m-1;
			else l = m;
			last++;
		}
		PutBack(l);
		//last = (i+1)*log2(k);
	}
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:52:25: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   52 |   if(tmp != ss.end()) { WriteAdvice(1); continue; }
      |                         ^~~~~~~~~~~
      |                         ComputeAdvice
advisor.cpp:53:8: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   53 |   else WriteAdvice(0);
      |        ^~~~~~~~~~~
      |        ComputeAdvice
advisor.cpp:63:20: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   63 |    if(m >= need) { WriteAdvice(0); l = m; }
      |                    ^~~~~~~~~~~
      |                    ComputeAdvice
advisor.cpp:64:11: error: 'WriteAdvice' was not declared in this scope; did you mean 'ComputeAdvice'?
   64 |    else { WriteAdvice(1); r = m-1; }
      |           ^~~~~~~~~~~
      |           ComputeAdvice