factories.cpp:144:2: warning: "/*" within comment [-Wcomment]
}/**/
factories.cpp: In function 'void sizedfs(int, int)':
factories.cpp:3:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define fori(a,b) for(long long i=a;i<b;++i)
~^~~~~~~~
#define forj(a,b) for(long long j=a;j<b;++j)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define fork(a,b) for(long long k=a;k<b;++k)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
using namespace std;
~~~~~~~~~~~~~~~~~~~~~
const int N=500000;
~~~~~~~~~~~~~~~~~~~~
~
int lvl[N],par[N],sz[N],V,x,y,z,xx,tot,l,cnt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
long long ans[N],cd[N][19];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vector<int> gr[N],dist[N];
~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool blc[N];
~~~~~~~~~~~~~
queue<int> sub;
~~~~~~~~~~~~~~~~
~
void sizedfs(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
sz[v]=1;
~~~~~~~~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~
factories.cpp:19:5: note: in expansion of macro 'fori'
fori(0,gr[v].size())
^~~~
factories.cpp: In function 'int getCenter(int, int)':
factories.cpp:3:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define fori(a,b) for(long long i=a;i<b;++i)
~^~~~~~~~
#define forj(a,b) for(long long j=a;j<b;++j)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define fork(a,b) for(long long k=a;k<b;++k)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
using namespace std;
~~~~~~~~~~~~~~~~~~~~~
const int N=500000;
~~~~~~~~~~~~~~~~~~~~
~
int lvl[N],par[N],sz[N],V,x,y,z,xx,tot,l,cnt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
long long ans[N],cd[N][19];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vector<int> gr[N],dist[N];
~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool blc[N];
~~~~~~~~~~~~~
queue<int> sub;
~~~~~~~~~~~~~~~~
~
void sizedfs(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
sz[v]=1;
~~~~~~~~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~~~
{
~~
if(!blc[gr[v][i]]&&gr[v][i]!=p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
sizedfs(gr[v][i],v);
~~~~~~~~~~~~~~~~~~~~~
sz[v]+=sz[gr[v][i]];
~~~~~~~~~~~~~~~~~~~~~
}
~~
}
~~
}
~~
~
int getCenter(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~
factories.cpp:31:5: note: in expansion of macro 'fori'
fori(0,gr[v].size())
^~~~
factories.cpp: In function 'void dfs(int, int)':
factories.cpp:3:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define fori(a,b) for(long long i=a;i<b;++i)
~^~~~~~~~
#define forj(a,b) for(long long j=a;j<b;++j)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define fork(a,b) for(long long k=a;k<b;++k)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
using namespace std;
~~~~~~~~~~~~~~~~~~~~~
const int N=500000;
~~~~~~~~~~~~~~~~~~~~
~
int lvl[N],par[N],sz[N],V,x,y,z,xx,tot,l,cnt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
long long ans[N],cd[N][19];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vector<int> gr[N],dist[N];
~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool blc[N];
~~~~~~~~~~~~~
queue<int> sub;
~~~~~~~~~~~~~~~~
~
void sizedfs(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
sz[v]=1;
~~~~~~~~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~~~
{
~~
if(!blc[gr[v][i]]&&gr[v][i]!=p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
sizedfs(gr[v][i],v);
~~~~~~~~~~~~~~~~~~~~~
sz[v]+=sz[gr[v][i]];
~~~~~~~~~~~~~~~~~~~~~
}
~~
}
~~
}
~~
~
int getCenter(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~~~
if(sz[gr[v][i]]*2>tot&&!blc[gr[v][i]]&&gr[v][i]!=p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return getCenter(gr[v][i],v);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
blc[v]=true;
~~~~~~~~~~~~~
return v;
~~~~~~~~~~
}
~~
~
void dfs(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~
{
~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~
factories.cpp:40:5: note: in expansion of macro 'fori'
fori(0,gr[v].size())
^~~~
factories.cpp: In function 'void Init(int, int*, int*, int*)':
factories.cpp:3:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define fori(a,b) for(long long i=a;i<b;++i)
~^~~~~~~~
#define forj(a,b) for(long long j=a;j<b;++j)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define fork(a,b) for(long long k=a;k<b;++k)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
using namespace std;
~~~~~~~~~~~~~~~~~~~~~
const int N=500000;
~~~~~~~~~~~~~~~~~~~~
~
int lvl[N],par[N],sz[N],V,x,y,z,xx,tot,l,cnt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
long long ans[N],cd[N][19];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vector<int> gr[N],dist[N];
~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool blc[N];
~~~~~~~~~~~~~
queue<int> sub;
~~~~~~~~~~~~~~~~
~
void sizedfs(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
sz[v]=1;
~~~~~~~~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~~~
{
~~
if(!blc[gr[v][i]]&&gr[v][i]!=p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
sizedfs(gr[v][i],v);
~~~~~~~~~~~~~~~~~~~~~
sz[v]+=sz[gr[v][i]];
~~~~~~~~~~~~~~~~~~~~~
}
~~
}
~~
}
~~
~
int getCenter(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~~~
if(sz[gr[v][i]]*2>tot&&!blc[gr[v][i]]&&gr[v][i]!=p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return getCenter(gr[v][i],v);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
blc[v]=true;
~~~~~~~~~~~~~
return v;
~~~~~~~~~~
}
~~
~
void dfs(int v,int p)
~~~~~~~~~~~~~~~~~~~~~~
{
~~
fori(0,gr[v].size())
~~~~~~~~~~~~~~~~~~~~~
if(lvl[gr[v][i]]>l&&gr[v][i]!=p)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
cd[gr[v][i]][l]=cd[v][l]+dist[v][i];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dfs(gr[v][i],v);
~~~~~~~~~~~~~~~~~
}
~~
}
~~
~
void Init(int n,int a[],int b[],int d[])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
~~
V=n;
~~~~~
fori(0,V)
~~~~~~~~~~
forj(0,19)
~~~~~~~~~~~
cd[i][j]=LLONG_MAX;
~~~~~~~~~~~~~~~~~~~~
fori(0,V-1)
~~~~~~~~~~~~
{
~~
gr[a[i]].push_back(b[i]); gr[b[i]].push_back(a[i]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dist[a[i]].push_back(d[i]); dist[b[i]].push_back(d[i]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
~~
sub.push(0); par[0]=-1;
~~~~~~~~~~~~~~~~~~~~~~~~
while(!sub.empty())
~~~~~~~~~~~~~~~~~~~~
{
~~
x=sub.front(); sub.pop();
~~~~~~~~~~~~~~~~~~~~~~~~~~
sizedfs(x,-1); tot=sz[x];
~~~~~~~~~~~~~~~~~~~~~~~~~~
y=getCenter(x,-1);
~~~~~~~~~~~~~~~~~~~
par[y]=par[x];
~~~~~~~~~~~~~~~
if(par[y]!=-1)
~~~~~~~~~~~~~~~
lvl[y]=lvl[par[y]]+1;
~~~~~~~~~~~~~~~~~~~~~~
fori(0,gr[y].size())
~~~~~~~~~~~~~~~~~~~
factories.cpp:68:9: note: in expansion of macro 'fori'
fori(0,gr[y].size())
^~~~
factories.cpp: In function 'long long int Query(int, int*, int, int*)':
factories.cpp:86:17: warning: overflow in implicit constant conversion [-Woverflow]
xx=LLONG_MAX>>2;
^
factories.cpp:103:50: error: no matching function for call to 'min(int&, long long int)'
xx=min(xx,0LL+ans[x]+cd[a[i]][lvl[x]]);
^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
from /usr/include/c++/7/ios:40,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from factories.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
min(const _Tp& __a, const _Tp& __b)
^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed:
factories.cpp:103:50: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
xx=min(xx,0LL+ans[x]+cd[a[i]][lvl[x]]);
^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
from /usr/include/c++/7/ios:40,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /usr/include/c++/7/complex:45,
from /usr/include/c++/7/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
from factories.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed:
factories.cpp:103:50: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
xx=min(xx,0LL+ans[x]+cd[a[i]][lvl[x]]);
^
In file included from /usr/include/c++/7/algorithm:62:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
from factories.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
min(initializer_list<_Tp> __l)
^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: template argument deduction/substitution failed:
factories.cpp:103:50: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
xx=min(xx,0LL+ans[x]+cd[a[i]][lvl[x]]);
^
In file included from /usr/include/c++/7/algorithm:62:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
from factories.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
min(initializer_list<_Tp> __l, _Compare __comp)
^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: template argument deduction/substitution failed:
factories.cpp:103:50: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
xx=min(xx,0LL+ans[x]+cd[a[i]][lvl[x]]);
^