Comments

can anybody tell why this solution of Problem I(eye) is getting wrong answer on test 27 while this 269511518 getting accepted!!

bool dfs(vvl &adj , ll u , ll par , vl &vis , vl&sym, ll &curr)
{
	if (par == 0)
	{
		sym[u] = 1; // pos;
		curr++;
	}
	else
	{
		sym[u] = (sym[par] == 0);
		if (sym[u])curr += 1;
		else curr -= 1;
	}
	vis[u] = 1;
	for (auto v : adj[u])
	{
		if (!vis[v] && par != v)
		{
			if (!dfs(adj , v , u , vis , sym , curr))
			{
				return 0;
			}
		}

		if (sym[u] == sym[v])
		{
			return 0;
		}

	}

	return 1;
}

void solve()
{
	ll n;
	cin >> n;

	vvl adj(n + 1);
	vll po(n);
	vl r(n);

	forf(n, i)
	{
		cin >> po[i].ff >> po[i].ss >> r[i];
	}

	forf(n, i)
	{
		ll cr = r[i];
		ll x = po[i].ff , y = po[i].ss;
		for (int j = i + 1 ; j < n ; j++)
		{
			if ( (po[j].ff - x) * (po[j].ff - x) + (po[j].ss - y) * (po[j].ss - y) == (cr + r[j]) * (cr + r[j])  )
			{
				adj[i + 1].pb(j + 1);
				adj[j + 1].pb(i + 1);
			}
		}

	}

	debug(adj);

	ll curr = 0;
	vl vis(n + 1, 0);
	vl sym(n + 1, 0);
	for1(n, i)
	{
		if (!vis[i])
		{
			curr = 0;
			if (dfs(adj , i , 0 , vis, sym , curr) && curr != 0)
			{
				debug(sym);
				yes;
				rtn;
			}
		}
	}
	debug(sym);

	no;

}