답안 #596813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596813 2022-07-15T06:19:28 Z 장태환(#8448) Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include "dango3.h"

#include <vector>
using namespace std;
int vis[10100];
int NN;
void dfs(vector<int>x)
{
	int m = x.size() /NN/2;
	if (m == 0)
	{
		Answer(x);
		return;
	}
	vector<int>r;
	int i;
	memset(vis, 0, sizeof(vis));
	for (i = 0; i < x.size(); i++)
	{
		r.clear();
		int j;
		for (j = i + 1; j < x.size(); j++)
		{
			r.push_back(x[j]);
		}
		for (j = 0; j < i; j++)
		{
			if (vis[j])
				r.push_back(x[j]);
		}
		if (Query(r) < m)
		{
			vis[i] = 1;
		}
	}
	vector<int>a, b;
	for (i = 0; i < x.size(); i++)
	{
		if (vis[i])
			a.push_back(x[i]);
		else
			b.push_back(x[i]);
	}
	dfs(a);
	dfs(b);
}

void Solve(int N, int M) 
{
	NN = N;
	vector<int>r;
	int i;
	for (i = 0; i < N * M; i++)
		r.push_back(i+1);
	dfs(r);
}

Compilation message

dango3.cpp: In function 'void dfs(std::vector<int>)':
dango3.cpp:17:2: error: 'memset' was not declared in this scope
   17 |  memset(vis, 0, sizeof(vis));
      |  ^~~~~~
dango3.cpp:2:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "dango3.h"
  +++ |+#include <cstring>
    2 | 
dango3.cpp:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for (i = 0; i < x.size(); i++)
      |              ~~^~~~~~~~~~
dango3.cpp:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for (j = i + 1; j < x.size(); j++)
      |                   ~~^~~~~~~~~~
dango3.cpp:37:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for (i = 0; i < x.size(); i++)
      |              ~~^~~~~~~~~~