답안 #596814

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
596814 2022-07-15T06:20:49 Z 장태환(#8448) Super Dango Maker (JOI22_dango3) C++17
100 / 100
1119 ms 848 KB
#include "dango3.h"
#include <string.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: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++)
      |              ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 340 KB Output is correct
2 Correct 11 ms 412 KB Output is correct
3 Correct 12 ms 416 KB Output is correct
4 Correct 12 ms 412 KB Output is correct
5 Correct 10 ms 340 KB Output is correct
6 Correct 11 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 267 ms 480 KB Output is correct
2 Correct 266 ms 564 KB Output is correct
3 Correct 300 ms 612 KB Output is correct
4 Correct 283 ms 588 KB Output is correct
5 Correct 246 ms 496 KB Output is correct
6 Correct 250 ms 496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1010 ms 848 KB Output is correct
2 Correct 1022 ms 732 KB Output is correct
3 Correct 1110 ms 728 KB Output is correct
4 Correct 1119 ms 728 KB Output is correct
5 Correct 990 ms 696 KB Output is correct
6 Correct 961 ms 744 KB Output is correct