제출 #1237303

#제출 시각아이디문제언어결과실행 시간메모리
1237303CyberCow드문 곤충 (IOI22_insects)C++20
10 / 100
97 ms416 KiB
#include "insects.h"
#include <vector>
#include <random>
#include <algorithm>
using namespace std;
mt19937 rnd(1314);
//void move_inside(int i)
//
//void move_outside(int i)
//
//int press_button()


int min_cardinality(int N)
{
	vector<int> v;
	for (int i = 0; i < N; i++)
	{
		v.push_back(i);
	}
	shuffle(v.begin(), v.end(), rnd);
	for (int i = 0; i < v.size(); i++)
	{
		move_inside(i);
	}
	int skzb = press_button();
	int taza = press_button();
	int st = 1;
	while (st)
	{
		for (int i = 0; i < v.size(); i++)
		{
			move_outside(v[i]);
			int yntac = press_button();
			if (yntac != skzb)
			{
				vector<int> vv;
				vv.push_back(i);
				move_inside(v[i]);
				for (int j = i + 1; j < v.size(); j++)
				{
					move_outside(v[j]);
					int qaqul = press_button();
					if (qaqul != skzb)
					{
						vv.push_back(j);
					}
					move_inside(v[j]);
					if (vv.size() == skzb)
						break;
				}
				for (int j = 0; j < i; j++)
				{
					move_inside(v[j]);
				}
				for (int j = vv.size() - 1; j >= 0; j--)
				{
					move_outside(v[vv[j]]);
					swap(v[vv[j]], v.back());
					v.pop_back();
				}
				taza = press_button();
				if (taza == 0)
				{
					return skzb;
				}
				if (taza == 1)
				{
					return 1;
				}
				skzb = taza;
				break;
			}
		}
	}
}

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:76:1: warning: control reaches end of non-void function [-Wreturn-type]
   76 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...