# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1179609 | PlayVoltz | Two Transportations (JOI19_transportations) | C++20 | Compilation error | 0 ms | 0 KiB |
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
namespace{
int counter=0, val=0, phase=0, tempval;
vector<int> dist, done, notdone;
vector<bool> del;
vector<deque<pii> > graph;
}
void InitA(int n, int a, vector<int> u, vector<int> v, vector<int> c){
done.clear();
dist.clear();
graph.clear();
del.clear();
del.resize(n, 0);
done.resize(1, 0);
dist.resize(n, INT_MAX/2);
graph.resize(n);
dist[0]=counter=val=phase=0;
del[0]=1;
for (int i=1; i<n; ++i)notdone.pb(i);
for (int i=0; i<a; ++i){
graph[u[i]].pb(mp(c[i], v[i]));
graph[v[i]].pb(mp(c[i], u[i]));
}
for (int i=0; i<n; ++i)sort(graph[i].begin(), graph[i].end());
}
void ReceiveA(bool x){
++counter;
val=val*2+x;
if (!phase&&counter==9){
int dj=INT_MAX/2, best;
for (auto node:done){
while (graph[node].size()&&del[graph[node][0].se])graph[node].pop_front();
if (graph[node].empty())continue;
if (dist[node]+graph[node][0].fi<dj)dj=dist[node]+graph[node][0].fi, best=graph[node][0].se;
}
if (dj-max_element(dist.begin(), dist.end())<val){
SendA(0);
dist[best]=dj;
done.pb(best);
del[best]=1;
int id=0;
for (int i=0; i<notdone.size(); ++i)if (notdone[i]==best)id=i;
notdone.erase(find(notdone.begin(), notdone.end(), best));
for (int i=(int)log2(notdone.size()+1); i>=0; --i)SendA((1<<i)&id);
for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end())));
}
else{
SendA(1);
phase=1;
}
counter=val=0;
}
if (phase==1&&counter==(int)log2(notdone.size())+1){
tempval=val;
phase=2;
counter=val=0;
}
if (phase==2&&counter==9){
int best=notdone[tempval];
dist[best]=val+max_element(dist.begin(), dist.end());
done.pb(best);
del[best]=1;
notdone.erase(find(notdone.begin(), notdone.end(), best));
phase=counter=val=0;
}
}
vector<int> Answer(){
return dist;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
namespace{
int counter=0, val=0, phase=0, tempval, dj=INT_MAX/2, best;
vector<int> dist, done, notdone;
vector<bool> del;
vector<deque<pii> > graph;
void sendover(){
if (notdone.empty())return;
dj=INT_MAX/2;
for (auto node:done){
while (graph[node].size()&&del[graph[node][0].se])graph[node].pop_front();
if (graph[node].empty())continue;
if (dist[node]+graph[node][0].fi<dj)dj=dist[node]+graph[node][0].fi, best=graph[node][0].se;
}
for (int i=8; i>=0; --i)SendB((1<<i)&(dj-max_element(dist.begin(), dist.end())));
}
}
void InitB(int n, int a, vector<int> u, vector<int> v, vector<int> c){
done.clear();
dist.clear();
graph.clear();
del.clear();
del.resize(n, 0);
done.resize(1, 0);
dist.resize(n, INT_MAX/2);
graph.resize(n);
dist[0]=counter=val=phase=0;
del[0]=1;
for (int i=1; i<n; ++i)notdone.pb(i);
for (int i=0; i<a; ++i){
graph[u[i]].pb(mp(c[i], v[i]));
graph[v[i]].pb(mp(c[i], u[i]));
}
for (int i=0; i<n; ++i)sort(graph[i].begin(), graph[i].end());
sendover();
}
void ReceiveB(bool x){
++counter;
val=val*2+x;
if (!phase){
if (val){
dist[best]=dj;
done.pb(best);
del[best]=1;
int id=0;
for (int i=0; i<notdone.size(); ++i)if (notdone[i]==best)id=i;
notdone.erase(find(notdone.begin(), notdone.end(), best));
for (int i=log2(notdone.size()+1); i>=0; --i)SendB((1<<i)&id);
for (int i=8; i>=0; --i)SendB((1<<i)&(dj-max_element(dist.begin(), dist.end())));
sendover();
}
else phase=1;
val=counter=0;
}
if (phase==1&&counter==(int)log2(notdone.size())+1){
tempval=val;
phase=2;
counter=val=0;
}
if (phase==2&&counter==9){
int best=notdone[tempval];
dist[best]=val+max_element(dist.begin(), dist.end());
done.pb(best);
del[best]=1;
notdone.erase(find(notdone.begin(), notdone.end(), best));
phase=counter=val=0;
sendover();
}
}
Compilation message (stderr)
# 1번째 컴파일 단계 Azer.cpp: In function 'void ReceiveA(bool)': Azer.cpp:47:23: error: no match for 'operator-' (operand types are 'int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >') 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | int __gnu_cxx::__normal_iterator<int*, std::vector<int> > In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:577:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorR>&)' 577 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:577:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::reverse_iterator<_IteratorL>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1693:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)' 1693 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1693:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:362:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)' 362 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/11/complex:362:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::complex<_Tp>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:371:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&)' 371 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/11/complex:371:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::complex<_Tp>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:380:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const _Tp&, const std::complex<_Tp>&)' 380 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/11/complex:380:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::complex<_Tp>' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:457:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&)' 457 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/11/complex:457:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::complex<_Tp>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const std::valarray<_Tp>&)' 1187 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::valarray<_Tp>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)' 1187 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const std::valarray<_Tp>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)' 1187 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::valarray<_Tp>' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1255:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> constexpr decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)' 1255 | operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1255:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1268:5: note: candidate: 'template<class _Iterator, class _Container> constexpr typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)' 1268 | operator-(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1268:5: note: template argument deduction/substitution failed: Azer.cpp:47:60: note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int' 47 | if (dj-max_element(dist.begin(), dist.end())<val){ | ^ Azer.cpp:56:65: error: no match for 'operator-' (operand types are 'int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >') 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | int __gnu_cxx::__normal_iterator<int*, std::vector<int> > In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:577:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorR>&)' 577 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:577:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::reverse_iterator<_IteratorL>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1693:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)' 1693 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1693:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:362:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)' 362 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/11/complex:362:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::complex<_Tp>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:371:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&)' 371 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/11/complex:371:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::complex<_Tp>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:380:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const _Tp&, const std::complex<_Tp>&)' 380 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/11/complex:380:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::complex<_Tp>' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from Azer.cpp:2: /usr/include/c++/11/complex:457:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&)' 457 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/11/complex:457:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::complex<_Tp>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/valarray:603, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const std::valarray<_Tp>&)' 1187 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::valarray<_Tp>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)' 1187 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const std::valarray<_Tp>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95, from Azer.cpp:2: /usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)' 1187 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'const std::valarray<_Tp>' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1255:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> constexpr decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)' 1255 | operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1255:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ In file included from /usr/include/c++/11/bits/stl_algobase.h:67, from /usr/include/c++/11/vector:60, from Azer.h:6, from Azer.cpp:1: /usr/include/c++/11/bits/stl_iterator.h:1268:5: note: candidate: 'template<class _Iterator, class _Container> constexpr typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)' 1268 | operator-(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/stl_iterator.h:1268:5: note: template argument deduction/substitution failed: Azer.cpp:56:102: note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int' 56 | for (int i=8; i>=0; --i)SendA((1<<i)&(dj-max_element(dist.begin(), dist.end()))); | ^ Azer.cpp:71:31: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment 71 | dist[best]=val+max_element(dist.begin(), dist.end()); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | __gnu_cxx::__normal_iterator<int*, std::vector<int> >