Submission #293473

#TimeUsernameProblemLanguageResultExecution timeMemory
293473MuhammetaliHighway Tolls (IOI18_highway)C++11
Compilation error
0 ms0 KiB
#include "highway.h"
#include <bits/stdc++.h>
#define REP(i,a) for (int i = 0; i < (a); ++i)
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define trav(a,x) for (auto& a: x)
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)
{
	REP(i,par[k].size())
	{
		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);
	REP(i,coun.size())
	{
		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(i,0,1)
	{
		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};
	REP(i,U.size())
	{
		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:3:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                    ^
highway.cpp:13:2: note: in expansion of macro 'REP'
   13 |  REP(i,par[k].size())
      |  ^~~
highway.cpp: In function 'void sum(int)':
highway.cpp:3:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                    ^
highway.cpp:25:2: note: in expansion of macro 'REP'
   25 |  REP(i,coun.size())
      |  ^~~
highway.cpp:28:32: error: overloaded function with no contextual type information
   28 |   if (jem[coun[i]]!=toll)count.erase(i,1);
      |                                ^~~~~
highway.cpp: In function 'void recur(int, int)':
highway.cpp:35:13: error: 'sum' cannot be used as a function
   35 |   sum(ask(v));
      |             ^
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:3:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                    ^
highway.cpp:50:2: note: in expansion of macro 'REP'
   50 |  REP(i,U.size())
      |  ^~~
highway.cpp:66:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   66 |  answer(count[0],0);
      |                ^