제출 #293464

#제출 시각아이디문제언어결과실행 시간메모리
293464Muhammetali통행료 (IOI18_highway)C++11
컴파일 에러
0 ms0 KiB
#include "highway.h"
#include <bits/stdc++.h>
#define mp make_pair
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#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;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
const int N=2e5+1;
template<class T>bool tmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool tmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
vl v,ab,count;
vecot<pair<ll,ll>> par[N];
ll a,b,jem[N]={INT_MAX};
void dfs(ll k,ll gos=0)
{
	REP(i,sz(par[k]))
	{
		if (jem[par[k].first]>gos+ab[v[par[k].second]])
		{
			jem[par[k].first]=gos+ab[v[par[k].second]];
			dfs(par[k].first,gos+ab[v[par[k].second]]);
		}
	}
}
void sum(ll toll)
{
	dfs(1);
	REP(i,sz(count))
	{
		if (count[i]==1)continue;
		if (jem[count[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[N]={0};
	REP(i,sz(U))
	{
		if (bo[U[i]]==0)
		{
			bo[U[i]]=1;
			count.push_back(U[i]);
		}
		if (bo[V[i]]==0)
		{
			bo[V[i]]=1;
			count.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],count[1]);
}

컴파일 시 표준 에러 (stderr) 메시지

highway.cpp:32:1: error: 'vecot' does not name a type
   32 | vecot<pair<ll,ll>> par[N];
      | ^~~~~
highway.cpp: In function 'void dfs(ll, ll)':
highway.cpp:36:11: error: 'par' was not declared in this scope
   36 |  REP(i,sz(par[k]))
      |           ^~~
highway.cpp:14:39: note: in definition of macro 'REP'
   14 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                       ^
highway.cpp:36:8: note: in expansion of macro 'sz'
   36 |  REP(i,sz(par[k]))
      |        ^~
highway.cpp: In function 'void sum(ll)':
highway.cpp:48:11: error: reference to 'count' is ambiguous
   48 |  REP(i,sz(count))
      |           ^~~~~
highway.cpp:14:39: note: in definition of macro 'REP'
   14 | #define REP(i,a) for (int i = 0; i < (a); ++i)
      |                                       ^
highway.cpp:48:8: note: in expansion of macro 'sz'
   48 |  REP(i,sz(count))
      |        ^~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~
highway.cpp:50:7: error: reference to 'count' is ambiguous
   50 |   if (count[i]==1)continue;
      |       ^~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~
highway.cpp:51:11: error: reference to 'count' is ambiguous
   51 |   if (jem[count[i]]!=toll)count.erase(i,1);
      |           ^~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~
highway.cpp:51:27: error: reference to 'count' is ambiguous
   51 |   if (jem[count[i]]!=toll)count.erase(i,1);
      |                           ^~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~
highway.cpp: In function 'void recur(int, int)':
highway.cpp:58:11: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'vl' {aka 'std::vector<long long int>'}
   58 |   sum(ask(v));
      |           ^
In file included from highway.cpp:1:
highway.h:7:39: note: in passing argument 1 of 'long long int ask(const std::vector<int>&)'
    7 | long long ask(const std::vector<int> &w);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^
highway.cpp:58:13: error: 'sum' cannot be used as a function
   58 |   sum(ask(v));
      |             ^
highway.cpp: In function 'void find_pair(int, std::vector<int>, std::vector<int>, int, int)':
highway.cpp:78:4: error: reference to 'count' is ambiguous
   78 |    count.push_back(U[i]);
      |    ^~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~
highway.cpp:83:4: error: reference to 'count' is ambiguous
   83 |    count.push_back(V[i]);
      |    ^~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~
highway.cpp:85:3: error: 'par' was not declared in this scope
   85 |   par[U[i]].push_back({V[i],i});
      |   ^~~
highway.cpp:89:9: error: reference to 'count' is ambiguous
   89 |  answer(count[0],count[1]);
      |         ^~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~
highway.cpp:89:18: error: reference to 'count' is ambiguous
   89 |  answer(count[0],count[1]);
      |                  ^~~~~
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from highway.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:4107:5: note: candidates are: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4107 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
highway.cpp:31:9: note:                 'vl count'
   31 | vl v,ab,count;
      |         ^~~~~