Submission #164458

# Submission time Handle Problem Language Result Execution time Memory
164458 2019-11-20T17:34:53 Z Lawliet ICC (CEOI16_icc) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
//#include "icc.h"

using namespace std;
typedef pair<int,int> pii;

const int MAXN = 60;

int N;

int other[MAXN];

bool marc[MAXN];

vector< int > adj[MAXN];

void DFS(int cur)
{
	marc[ cur ] = true;

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

		if( marc[viz] ) continue;

		DFS( viz );
	}
}

void run(int n)
{
	N = n;

	for(int k = 1 ; k < N ; k++)
	{
		bool find = false;

		int ansA = 0;
		int ansB = 0;

		for(int i = 1 ; i <= n && !find ; i++)
		{
			memset( marc , false , sizeof( marc ) );
			DFS( i );

			int cur[] = { i };

			int p = 0;

			for(int j = 1 ; j <= n ; j++)
				if( !marc[j] ) other[ p++ ] = j;

			if( query( 1 , p , cur , other ) == 1 )
			{
				ansA = i;

				for(int j = 0 ; j < p && !find ; j++)
				{
					int V[] = { other[j] };

					if( query( 1 , 1 , cur , V ) == 1 )
					{
						ansB = other[j];
						find = true;
					}
				}
			}
		}

		adj[ ansB ].push_back( ansA );
		adj[ ansA ].push_back( ansB );

		setRoad( ansA , ansB );
	}
}

Compilation message

icc.cpp: In function 'void DFS(int)':
icc.cpp:21:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < adj[cur].size() ; i++)
                  ~~^~~~~~~~~~~~~~~~~
icc.cpp: In function 'void run(int)':
icc.cpp:54:8: error: 'query' was not declared in this scope
    if( query( 1 , p , cur , other ) == 1 )
        ^~~~~
icc.cpp:74:3: error: 'setRoad' was not declared in this scope
   setRoad( ansA , ansB );
   ^~~~~~~