Submission #293474

#TimeUsernameProblemLanguageResultExecution timeMemory
293474MuhammetaliHighway Tolls (IOI18_highway)C++11
Compilation error
0 ms0 KiB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v,ab,coun;
vector<pair<int,int>> par[1000];
int a,b,jem[1000]={INT_MAX};
void dfs(int k,int gos=0)
{
	for(ll i=0;i<par[k].size();i++)
	{
		if (jem[par[k][i].first]>gos+ab[v[par[k][i].second]])
		{
			jem[par[k][i].first]=gos+ab[v[par[k][i].second]];
			dfs(par[k][i].first,gos+ab[v[par[k][i].second]]);
		}
	}
}
void sum(int toll)
{
	dfs(1);
	for(ll i=0;i<coun.size();i++)
	{
		if (coun[i]==1)continue;
		if (jem[coun[i]]!=toll)count.erase(i,1);
	}
}
void recur(int M,int sum=0)
{
	if (sum==M)
	{
		sum(ask(v));
		return;
	}
	for(ll i=0;i<2;i++)
	{
		v.push_back(i);
		recur(M,sum+1);
		v.pop_back();
	}
}
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
	int M = U.size();
	ab.push_back(A);
	ab.push_back(B);
	bool bo[1000]={0};
	for(ll i=0;i<U.size();i++)
	{
		if (bo[U[i]]==0)
		{
			bo[U[i]]=1;
			coun.push_back(U[i]);
		}
		if (bo[V[i]]==0)
		{
			bo[V[i]]=1;
			coun.push_back(V[i]);
		}
		par[U[i]].push_back({V[i],i});
		par[V[i]].push_back({U[i],i});
	}
	recur(M);
	answer(count[0],0);
}

Compilation message (stderr)

highway.cpp: In function 'void dfs(int, int)':
highway.cpp:9:6: error: 'll' was not declared in this scope
    9 |  for(ll i=0;i<par[k].size();i++)
      |      ^~
highway.cpp:9:13: error: 'i' was not declared in this scope
    9 |  for(ll i=0;i<par[k].size();i++)
      |             ^
highway.cpp: In function 'void sum(int)':
highway.cpp:21:6: error: 'll' was not declared in this scope; did you mean 'toll'?
   21 |  for(ll i=0;i<coun.size();i++)
      |      ^~
      |      toll
highway.cpp:21:13: error: 'i' was not declared in this scope
   21 |  for(ll i=0;i<coun.size();i++)
      |             ^
highway.cpp:24:32: error: overloaded function with no contextual type information
   24 |   if (jem[coun[i]]!=toll)count.erase(i,1);
      |                                ^~~~~
highway.cpp: In function 'void recur(int, int)':
highway.cpp:31:13: error: 'sum' cannot be used as a function
   31 |   sum(ask(v));
      |             ^
highway.cpp:34:6: error: 'll' was not declared in this scope
   34 |  for(ll i=0;i<2;i++)
      |      ^~
highway.cpp:34:13: error: 'i' was not declared in this scope
   34 |  for(ll i=0;i<2;i++)
      |             ^
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:46:6: error: 'll' was not declared in this scope
   46 |  for(ll i=0;i<U.size();i++)
      |      ^~
highway.cpp:46:13: error: 'i' was not declared in this scope
   46 |  for(ll i=0;i<U.size();i++)
      |             ^
highway.cpp:62:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   62 |  answer(count[0],0);
      |                ^