Submission #830524

# Submission time Handle Problem Language Result Execution time Memory
830524 2023-08-19T07:42:04 Z josanneo22 Rarest Insects (IOI22_insects) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define ld long double
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second

/*草,以后一定要拿金牌啊!!! 注意数值范围拿分数哦*/
const int S=1e5+5;
mt19937 rand1(time(0));
int l,r,cnt,cnt1,a[S],n;
bool vs[S],vs1[S];

void ins(int x) {++cnt1;move_inside(x-1);}
void dlt(int x) {--cnt1;move_outside(x-1);}
int qry() {return press_button();}

int min_cardinality(int N) {
	n=N;
	for(int i=1;i<=n;++i) {
		ins(i);
		if(qry()>1) dlt(i);
		else vs[i]=1,++cnt;
	}
	if(cnt==1) return n;
	l=2;r=n/cnt;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		for(int i=1;i<=n;++i) {vs1[i]=0,a[i]=i;}
		shuffle(a+1,a+n+1,rand1);
		for(int i=1;i<=n;++i){
			if(!vs[a[i]])
			{
				if(cnt*mid<=cnt1) break;
				ins(a[i]);
				if(qry()>mid) dlt(a[i]);
				else vs1[a[i]]=1;
			}
		}
		if(cnt*mid<=cnt1) {
			l=mid+1;
			for(int i=1;i<=n;++i) if(vs1[i]) vs[i]=1;
		}
		else {
			r=cnt1/cnt;
			for(int i=1;i<=n;++i) {
				if(vs1[i]) dlt(i);
				else vs[i]=1;
			}
		}
	}
	return r;
}

Compilation message

insects.cpp: In function 'void ins(int)':
insects.cpp:17:25: error: 'move_inside' was not declared in this scope
   17 | void ins(int x) {++cnt1;move_inside(x-1);}
      |                         ^~~~~~~~~~~
insects.cpp: In function 'void dlt(int)':
insects.cpp:18:25: error: 'move_outside' was not declared in this scope
   18 | void dlt(int x) {--cnt1;move_outside(x-1);}
      |                         ^~~~~~~~~~~~
insects.cpp: In function 'int qry()':
insects.cpp:19:19: error: 'press_button' was not declared in this scope
   19 | int qry() {return press_button();}
      |                   ^~~~~~~~~~~~