| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1149830 | aktilek | Evacuation plan (IZhO18_plan) | C++20 | Compilation error | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define Fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int N = 2e5 + 7;
const int R = 1e9 + 10;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const int B = 320;
vector < pair < int, int >> g[N];
bool used[N];
ll dist[N];
int l[N], r[N], s[N], t[N];
int link[N], sz[N];
vector < pair < int, int > > kanye[6000000];
int ans[N];
int get(int x) {
if (link[x] == x) return x;
return link[x] = get(link[x]);
}
void unite(int x, int y) {
x = get(x);
y = get(y);
if (x == y) return;
if (sz[x] < sz[y]) swap(x, y);
sz[x] += sz[y];
link[y] = x;
}
void solve() {
int n, m;
cin >> n >> m;
vector < pair < int, int >> edge;
for (int i = 1; i <= m; i++) {
int u, v, w;
cin >> u >> v >> w;
edge.pb({u, v});
g[u].pb({v, w});
g[v].pb({u, w});
}
int atom;
cin >> atom;
for (int i = 1;i <= n; i++) {
dist[i] = INF;
}
priority_queue < pair < int, int > > q;
for (int i = 1; i <= atom; i++) {
int x;
cin >> x;
q.push({0, x});
dist[x] = 0;
}
while (q.size()) {
int a = q.top().S; q.pop();
if (used[a]) continue;
used[a] = true;
for (auto v : g[a]) {
int b = v.F, w = v.S;
if (dist[a] + w < dist[b]) {
dist[b] = dist[a] + w;
q.push({-dist[b], b});
}
}
}
vector < pair < int, pair < int, int >>> edges;
for (int i = 0; i < m; i++) {
int d = min(dist[edge[i].F], dist[edge[i].S]);
edges.pb({d, {edge[i].F, edge[i].S}});
}
sort(rall(edges));
vector < int > west;
for (auto ye : edges) {
// cout << ye.F << ' ' << ye.S.F << ' ' << ye.S.S << '\n';
kanye[ye.F].pb({ye.S.F, ye.S.S});
if (west.size() == 0 || west.back() != ye.F) {
west.pb(ye.F);
}
}
// for (int x : west) cout << x << ' ';
int z;
cin >> z;
for (int i = 1; i <= z; i++) {
cin >> s[i] >> t[i];
l[i] = 0, r[i] = int(west.size()) - 1;
}
int steps = 30;
while (steps--) {
vector < int > requests[m + 7];
for (int i = 1; i <= z; i++) {
if (l[i] > r[i]) continue;
int mid = (l[i] + r[i]) / 2;
requests[mid].pb(i);
}
for (int i = 1; i <= n; i++) {
link[i] = i;
sz[i] = 1;
}
for (int i = 0; i < west.size(); i++) {
for (auto x : kanye[west[i]]) {
unite(x.F, x.S);
}
for (int j : requests[i]) {
if (get(s[j]) == get(t[j])) {
ans[j] = west[i];
r[j] = i - 1;
} else {
l[j] = i + 1;
}
}
}
}
for (int i = 1; i <= z; i++) {
cout << ans[i] << '\n';
}
}
int main() {
// freopen("gates.in", "r", stdin);
// freopen("gates.out", "w", stdout);
Fast
int tc = 1;
// cin >> tc;
while (tc--) {
solve();
}
}
Compilation message (stderr)
plan.cpp:23:11: error: 'int link [200007]' redeclared as different kind of entity
23 | int link[N], sz[N];
| ^
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /usr/include/c++/11/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:43,
from plan.cpp:1:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
819 | extern int link (const char *__from, const char *__to)
| ^~~~
plan.cpp: In function 'int get(int)':
plan.cpp:28:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
28 | if (link[x] == x) return x;
| ^
plan.cpp:28:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
28 | if (link[x] == x) return x;
| ~~~~~~~~^~~~
plan.cpp:29:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
29 | return link[x] = get(link[x]);
| ^
plan.cpp:29:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
29 | return link[x] = get(link[x]);
| ^
plan.cpp:29:29: error: no matching function for call to 'get(int (&)(const char*, const char*) noexcept)'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:223:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_OIter1, _OIter2> >::type& std::get(std::pair<_OIter1, _OIter2>&)'
223 | get(pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/11/utility:223:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::pair<_OIter1, _OIter2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:228:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_OIter1, _OIter2> >::type&& std::get(std::pair<_OIter1, _OIter2>&&)'
228 | get(pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/11/utility:228:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::pair<_OIter1, _OIter2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:233:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_OIter1, _OIter2> >::type& std::get(const std::pair<_OIter1, _OIter2>&)'
233 | get(const pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/11/utility:233:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::pair<_OIter1, _OIter2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:238:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_OIter1, _OIter2> >::type&& std::get(const std::pair<_OIter1, _OIter2>&&)'
238 | get(const pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/11/utility:238:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::pair<_OIter1, _OIter2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:247:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)'
247 | get(pair<_Tp, _Up>& __p) noexcept
| ^~~
/usr/include/c++/11/utility:247:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::pair<_T1, _T2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:252:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)'
252 | get(const pair<_Tp, _Up>& __p) noexcept
| ^~~
/usr/include/c++/11/utility:252:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::pair<_T1, _T2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:257:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)'
257 | get(pair<_Tp, _Up>&& __p) noexcept
| ^~~
/usr/include/c++/11/utility:257:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::pair<_T1, _T2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:262:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_T1, _T2>&&)'
262 | get(const pair<_Tp, _Up>&& __p) noexcept
| ^~~
/usr/include/c++/11/utility:262:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::pair<_T1, _T2>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:267:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)'
267 | get(pair<_Up, _Tp>& __p) noexcept
| ^~~
/usr/include/c++/11/utility:267:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::pair<_Up, _Tp>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:272:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)'
272 | get(const pair<_Up, _Tp>& __p) noexcept
| ^~~
/usr/include/c++/11/utility:272:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::pair<_Up, _Tp>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:277:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)'
277 | get(pair<_Up, _Tp>&& __p) noexcept
| ^~~
/usr/include/c++/11/utility:277:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::pair<_Up, _Tp>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/utility:282:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_Up, _Tp>&&)'
282 | get(const pair<_Up, _Tp>&& __p) noexcept
| ^~~
/usr/include/c++/11/utility:282:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::pair<_Up, _Tp>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/bits/ranges_algo.h:36,
from /usr/include/c++/11/algorithm:64,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/bits/ranges_util.h:381:5: note: candidate: 'template<long unsigned int _Num, class _It, class _Sent, std::ranges::subrange_kind _Kind> requires _Num < 2 constexpr auto std::ranges::get(std::ranges::subrange<_It, _Sent, _Kind>&&)'
381 | get(subrange<_It, _Sent, _Kind>&& __r)
| ^~~
/usr/include/c++/11/bits/ranges_util.h:381:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::ranges::subrange<_It, _Sent, _Kind>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/bits/ranges_algo.h:36,
from /usr/include/c++/11/algorithm:64,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/bits/ranges_util.h:370:5: note: candidate: 'template<long unsigned int _Num, class _It, class _Sent, std::ranges::subrange_kind _Kind> requires _Num < 2 constexpr auto std::ranges::get(const std::ranges::subrange<_It, _Sent, _Kind>&)'
370 | get(const subrange<_It, _Sent, _Kind>& __r)
| ^~~
/usr/include/c++/11/bits/ranges_util.h:370:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::ranges::subrange<_It, _Sent, _Kind>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/array:361:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)'
361 | get(array<_Tp, _Nm>& __arr) noexcept
| ^~~
/usr/include/c++/11/array:361:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::array<_Tp, _Nm>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/array:369:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)'
369 | get(array<_Tp, _Nm>&& __arr) noexcept
| ^~~
/usr/include/c++/11/array:369:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::array<_Tp, _Nm>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/array:377:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)'
377 | get(const array<_Tp, _Nm>& __arr) noexcept
| ^~~
/usr/include/c++/11/array:377:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::array<_Tp, _Nm>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/tuple:39,
from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/array:385:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const std::array<_Tp, _Nm>&&)'
385 | get(const array<_Tp, _Nm>&& __arr) noexcept
| ^~~
/usr/include/c++/11/array:385:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::array<_Tp, _Nm>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1393:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >& std::get(std::tuple<_UTypes ...>&)'
1393 | get(tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1393:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1399:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >& std::get(const std::tuple<_UTypes ...>&)'
1399 | get(const tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1399:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1405:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >&& std::get(std::tuple<_UTypes ...>&&)'
1405 | get(tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1405:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1414:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_UTypes ...> >&& std::get(const std::tuple<_UTypes ...>&&)'
1414 | get(const tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1414:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1449:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_UTypes ...>&)'
1449 | get(tuple<_Types...>& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1449:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1460:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_UTypes ...>&&)'
1460 | get(tuple<_Types...>&& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1460:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1471:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_UTypes ...>&)'
1471 | get(const tuple<_Types...>& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1471:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/11/functional:54,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
from plan.cpp:1:
/usr/include/c++/11/tuple:1483:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::tuple<_UTypes ...>&&)'
1483 | get(const tuple<_Types...>&& __t) noexcept
| ^~~
/usr/include/c++/11/tuple:1483:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1676:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(std::variant<_Types ...>&)'
1676 | get(variant<_Types...>& __v)
| ^~~
/usr/include/c++/11/variant:1676:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1687:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(std::variant<_Types ...>&&)'
1687 | get(variant<_Types...>&& __v)
| ^~~
/usr/include/c++/11/variant:1687:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1698:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(const std::variant<_Types ...>&)'
1698 | get(const variant<_Types...>& __v)
| ^~~
/usr/include/c++/11/variant:1698:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1709:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(const std::variant<_Types ...>&&)'
1709 | get(const variant<_Types...>&& __v)
| ^~~
/usr/include/c++/11/variant:1709:5: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1117:20: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::variant<_Types ...>&)'
1117 | constexpr _Tp& get(variant<_Types...>& __v)
| ^~~
/usr/include/c++/11/variant:1117:20: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1126:21: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::variant<_Types ...>&&)'
1126 | constexpr _Tp&& get(variant<_Types...>&& __v)
| ^~~
/usr/include/c++/11/variant:1126:21: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1136:26: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::variant<_Types ...>&)'
1136 | constexpr const _Tp& get(const variant<_Types...>& __v)
| ^~~
/usr/include/c++/11/variant:1136:26: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
from plan.cpp:1:
/usr/include/c++/11/variant:1145:27: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::variant<_Types ...>&&)'
1145 | constexpr const _Tp&& get(const variant<_Types...>&& __v)
| ^~~
/usr/include/c++/11/variant:1145:27: note: template argument deduction/substitution failed:
plan.cpp:29:29: note: mismatched types 'const std::variant<_Types ...>' and 'int(const char*, const char*) noexcept'
29 | return link[x] = get(link[x]);
| ~~~^~~~~~~~~
plan.cpp:27:5: note: candidate: 'int get(int)' (near match)
27 | int get(int x) {
| ^~~
plan.cpp:27:5: note: conversion of argument 1 would be ill-formed:
plan.cpp:29:36: error: invalid conversion from 'int (*)(const char*, const char*) noexcept' to 'int' [-fpermissive]
29 | return link[x] = get(link[x]);
| ~~~~~~^
| |
| int (*)(const char*, const char*) noexcept
plan.cpp: In function 'void unite(int, int)':
plan.cpp:38:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
38 | link[y] = x;
| ^
plan.cpp:38:17: error: assignment of read-only location '*(link + ((sizetype)y))'
38 | link[y] = x;
| ~~~~~~~~^~~
plan.cpp: In function 'void solve()':
plan.cpp:125:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
125 | link[i] = i;
| ^
plan.cpp:125:33: error: assignment of read-only location '*(link + ((sizetype)i))'
125 | link[i] = i;
| ~~~~~~~~^~~