답안 #99413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99413 2019-03-03T18:00:39 Z nad312 CEOI16_icc (CEOI16_icc) C++17
컴파일 오류
0 ms 0 KB
#include<icc.h>
#include<bits/stdc++.h>
#define P pair<lli, lli>
#define mp make_pair
#define x first
#define y second
using namespace std;
typedef long long int lli;
const lli N=109;
lli n, dd[N], cnt, a[N], b[N];
deque<lli> D[N], p[N], q1, q2, cop;

void DFS(lli u)
{
	p[cnt].push_back(u);
	dd[u]=1;
	for(auto v: D[u])
	{
		if(dd[v]==0)
		{
			DFS(v);
		}
	}
}
lli Add(lli x, lli y)
{
	if(x==0)
	{
		for(auto v: p[y])
		{
			q1.push_back(v);
		}
	}
	else
	{
		for(auto v: p[y])
		{
			q2.push_back(v);
		}
	}
	
}
lli Ask()
{
	lli s1=q1.size(), s2=q2.size();
	for(int i=0;i<s1;i++)
	{
		a[i]=q1[i];
	}
	for(int i=0;i<s2;i++)
	{
		b[i]=q2[i];
	}
	return query(s1, s2, a, b);
}
void Solve()
{
	lli l=0, h=q2.size()-1;
	cop=q2;
	while(l<h)
	{
		lli mid=(l+h)/2;
		q2.clear();
		for(int i=l;i<=mid;i++)
		{
			q2.push_back(cop[i]);
		}
		if(Ask())
		{
			h=mid;
		}
		else
		{
			l=mid+1;
		}
	}
	q2.clear();
	q2.push_back(cop[l]);
	cop=q1;
	l=0, h=q1.size()-1;
	while(l<h)
	{
		lli mid=(l+h)/2;
		q1.clear();
		for(int i=l;i<=mid;i++)
		{
			q1.push_back(cop[i]);
		}
		if(Ask())
		{
			h=mid;
		}
		else
		{
			l=mid+1;
		}
	}
	q1.clear();
	q1.push_back(l);
	setroad(q1[0], q2[0]);
}
void run(lli ndinh)
{
	n=ndinh;
	lli T=n-1;
	while(T--)
	{
		cnt=0;
		fill_n(&dd[0], sizeof(dd)/sizeof(dd[0]), 0);
		for(int i=1;i<=n;i++)
		{
			if(dd[i]==0)
			{
				cnt++;
				DFS(i);
			}
		}
		for(int bit=0;bit<8;bit++)
		{
			q1.clear();
			q2.clear();
			for(int i=1;i<=cnt;i++)
			{
				Add(((i>>bit)&1), i);
			}
			if(Ask())
			{
				Solve();
				break;
			}
		}
	}
}

Compilation message

icc.cpp: In function 'lli Add(lli, lli)':
icc.cpp:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
icc.cpp: In function 'lli Ask()':
icc.cpp:54:27: error: cannot convert 'lli* {aka long long int*}' to 'int*' for argument '3' to 'int query(int, int, int*, int*)'
  return query(s1, s2, a, b);
                           ^
icc.cpp: In function 'void Solve()':
icc.cpp:100:2: error: 'setroad' was not declared in this scope
  setroad(q1[0], q2[0]);
  ^~~~~~~
icc.cpp:100:2: note: suggested alternative: 'setRoad'
  setroad(q1[0], q2[0]);
  ^~~~~~~
  setRoad