답안 #24618

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
24618 2017-06-10T18:26:00 Z bill_kondo CEOI16_icc (CEOI16_icc) C++14
7 / 100
56 ms 2096 KB
#include "icc.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair <int, int> pii;

const int maxn = 1e2 + 10;

int n;
set <pii> e;

int c[maxn];
int d[maxn];

void acha ()
{
	for (int a = 1; a <= n; ++a)
		for (int b = a + 1; b <= n; ++b)
			if (e.find (pii (a, b)) == e.end())
			{
				c[0] = {a};
				d[0] = {b};

				if (query (1, 1, c, d))
				{
					e.insert (pii (a, b));
					setRoad (a, b);
					return;
				}
			}
}

int pointer;
vector <int> adj[maxn];
bool mrk[maxn];

int node;

void combina (int v)
{
	for (int i = 0; i < pointer; ++i)
	{
		int e[] = {d[i]};

		if (query (1, 1, c, e))
		{
			node = d[i];
			return;
		}
	}
}

void aresta ()
{	
	for (int v = 1; v <= n; ++v)
	{
		c[0] = v;

		mrk[v] = true;

		for (int i = 0; i < adj[v].size(); ++i)
		{
			int u = adj[v][i];

			mrk[u] = true;
		}

		pointer = 0;
		for (int u = 1; u <= n; ++u)
			if (!mrk[u])
				d[pointer++] = u;

		int q = query (1, pointer, c, d);

		if (q)
			combina (v);

		mrk[v] = false;

		for (int i = 0; i < adj[v].size(); ++i)
		{
			int u = adj[v][i];

			mrk[u] = false;
		}

		if (q)
		{
			adj[v].push_back (node);
			adj[node].push_back (v);
			setRoad (v, node);
			return;
		}
	}
}

void run (int N)
{
	n = N;

	for (int i = 1; i <= n - 1; ++i)
	{
		if (N <= 15) acha ();
		else if (N <= 50) aresta ();
	}
}

Compilation message

icc.cpp: In function 'void aresta()':
icc.cpp:61:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < adj[v].size(); ++i)
                     ^
icc.cpp:80:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < adj[v].size(); ++i)
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 2088 KB Ok! 1015 queries used.
2 Correct 56 ms 2096 KB Ok! 1010 queries used.
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 2092 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2056 KB Not all edges were guessed!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2056 KB Not all edges were guessed!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2056 KB Not all edges were guessed!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2056 KB Not all edges were guessed!
2 Halted 0 ms 0 KB -