제출 #1335129

#제출 시각아이디문제언어결과실행 시간메모리
1335129gohchingjaykRarest Insects (IOI22_insects)C++20
컴파일 에러
0 ms0 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;

signed min_cardinality(signed N) {
	using ll = long long;
	#define int ll

	bool inside[2005]{};
	bool ban[2005]{};
	int num_unique = 0;
	for (int i = 0; i < N; ++i) {
		move_inside(i);
		inside[i] = true;
		int call = press_button();
		if (call > 1) {
			move_outside(i);
			inside[i] = false;
		}
		else {
			num_unique++;
		}
	}
	
	int lo = 2; int hi = N / num_unique;
	int ans = 1;
	int last = 1;
	set<int> this_iter;
	while (lo <= hi) {
		int tgt = lo + (hi - lo) / 2;
		
		if (tgt < last) {

			for (int i : this_iter) {
				inside[i] = false;
				move_outside(i);
			}
			this_iter.clear();
		}
		
		for (int j = 0; j < N; ++j) {
			if (inside[j]) continue;
			if (ban[j]) continue;
			if (this_iter.size() == (num_unique * (tgt - ans))) break;

			remaining--;
			move_inside(j);
			inside[j] = true;
			int call = press_button();
			if (call > tgt) {
				move_outside(j);
				inside[j] = false;
				continue;
			}
			
			this_iter.emplace(j);
		}
		
		last = tgt;
		if (this_iter.size() == (num_unique * (tgt - ans))) {
			ans = tgt;
			lo = tgt + 1;
			this_iter.clear();
		}
		else {
			hi = tgt - 1;
			for (int j = 0; j < N; ++j) {
				if (!inside[j]) ban[j] = true;
			}
		}
	}

	return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:46:25: error: 'remaining' was not declared in this scope; did you mean 'remainder'?
   46 |                         remaining--;
      |                         ^~~~~~~~~
      |                         remainder