제출 #685609

#제출 시각아이디문제언어결과실행 시간메모리
685609irmuun드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "insects.h"
using namespace std;
int a[2005];
int min_cardinality(int n){
	int ans=1;
	int p[n+5];
	fill(p,p+n+1,0);
	int count=0;
	int left=n;
	int num=0;
	int sz;
	while(left>0){
		vector<int>v;
		count=0;
		for(int i=0;i<n;i++){
			if(p[i]==0){
				move_inside(i);
				if(count>0){
					move_inside(i);
					int x=press_button();
					if(x==2){
						count--;
						move_ouside(i);
					}
					else{
						v.pb(i);
					}
				}
				else{
					v.pb(i);
				}
				count++;
			}
		}
		if(num==0){
			sz=count;
			for(int i=0;i<sz;i++){
				p[v[i]]=1;
			}
		}
		else{
			if(v.size()<sz){
				ans=num;
				break;
			}
			for(int i=0;i<sz;i++){
				p[v[i]]=1;
			}
		}
		num++;
	}
	return ans;
}

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:24:7: error: 'move_ouside' was not declared in this scope; did you mean 'move_outside'?
   24 |       move_ouside(i);
      |       ^~~~~~~~~~~
      |       move_outside
insects.cpp:27:9: error: 'class std::vector<int>' has no member named 'pb'
   27 |       v.pb(i);
      |         ^~
insects.cpp:31:8: error: 'class std::vector<int>' has no member named 'pb'
   31 |      v.pb(i);
      |        ^~
insects.cpp:43:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |    if(v.size()<sz){
      |       ~~~~~~~~^~~