Submission #44756

#TimeUsernameProblemLanguageResultExecution timeMemory
44756PowerOfNinjaGoFactories (JOI14_factories)C++17
Compilation error
0 ms0 KiB
//Power Of Ninja Go #include <bits/stdc++.h> #ifdef atom #include "grader.cpp" #else #include "factories.h" #endif using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector< ii > vii; #define X first #define Y second #define pb push_back #define mp make_pair const int maxn = 5e5+5; vii adj[maxn]; int dp[22][maxn]; int h[maxn]; ll sweep[maxn]; int cnt[maxn]; bool use[maxn]; int tim = 1; int zil[maxn]; ll red[4*maxn], blue[4*maxn]; int n; ll query(ll *st, int i, int j, int p = 1, int L = 1, int R = n) { if(i> R || j< L) return 4e18; if(i<= L && R<= j) return st[p]; ll x = query(st, i, j, 2*p, L, (L+R)/2); ll y = query(st, i, j, 2*p+1, (L+R)/2+1, R); return min(x, y); } void build(ll *st, vector<pair<int, int> > &vec, int p = 1, int L = 1, int R = n) { if(L == R) { st[p] = sweep[vec[L].Y]; return; } build(st, vec, 2*p, L, (L+R)/2); build(st, vec, 2*p+1, (L+R)/2+1, R); st[p] = min(st[2*p], st[2*p+1]); } void trv(int u, int p) { cnt[u] = 1; zil[u] = tim; tim++; for(auto edge : adj[u]) { int v = edge.X, w = edge.Y; if(v != p) { h[v] = h[u]+1; dp[0][v] = u; sweep[v] = sweep[u]+w; trv(v, u); cnt[u] += cnt[v]; } } } bool cmp(int u, int v) { return zil[u]< zil[v]; } int LCA(int u, int v) { if(h[u]< h[v]) swap(u, v); //printf("%d %d\n", u, v); for(int i = 20; i>= 0; i--) { int x = dp[i][u]; if(h[x]>= h[v]) u = x; } if(u == v) return u; //printf("%d\n", h[7]); //printf("now %d %d\n", u, v); for(int i = 20; i>= 0; i--) { int x = dp[i][u], y = dp[i][v]; if(x == y) continue; u = x; v = y; } return dp[0][u]; } ll dist(int u, int v) { int x = LCA(u, v); return sweep[u]+sweep[v]-2LL*sweep[x]; } void Init(int N, int A[], int B[], int D[]) { n = N; for(int i = 0; i< N-1; i++) { int u, v; u = A[i]+1; v = B[i]+1; int w = D[i]; adj[u].pb(ii(v, w)); adj[v].pb(ii(u, w)); } h[1] = 1; trv(1, 0); for(int i = 1; i<= 20; i++) for(int j = 1; j<= N; j++) dp[i][j] = dp[i-1][dp[i-1][j]]; } long long Query(int S, int X[], int T, int Y[]) { vector<int> all; vector< ii > b, r; b.pb(ii(-1e9, 0)); r.pb(ii(-1e9, 0)); for(int i = 0; i< S; i++) X[i]++; for(int i = 0; i< T; i++) Y[i]++; for(int i = 0; i< S; i++) all.pb(X[i]), r.pb(mp(zil[X[i]], X[i])); for(int i = 0; i< T; i++) all.pb(Y[i]), b.pb(mp(zil[Y[i]], X[i])); sort(r.begin(), r.end()); sort(b.begin(), b.end()); build(red, r, 1, 1, S); build(blue, b, 1, 1, T); sort(all.begin(), all.end(), cmp); //for(auto x : all) printf("%d ", x); //printf("\n"); vector<int> matt; matt = all; for(int i = 1; i< (int) all.size(); i++) { int x = LCA(all[i], all[i-1]); if(x == all[i] or x == all[i-1]) continue; matt.pb(x); } ll best = 4e18; for(auto top : matt) { int lend = zil[top], rend = zil[top]+cnt[top]-1; int x1 = lower_bound(r.begin(), r.end(), mp(lend, (ll)-4e18))-r.begin(); int y1 = upper_bound(r.begin(), r.end(), mp(rend, (ll)4e18))-r.begin()-1; int x2 = lower_bound(b.begin(), b.end(), mp(lend, (ll)-4e18))-b.begin(); int y2 = upper_bound(b.begin(), b.end(), mp(rend, (ll)4e18))-b.begin()-1; ll bestred = query(red, x1, y1, 1, 1, S); ll bestblue = query(blue, x2, y2, 1, 1, T); best = min(best, bestred+bestblue-2*sweep[top]); } return best; }

Compilation message (stderr)

In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Value = const std::pair<int, long long int>]':
/usr/include/c++/7/bits/stl_algobase.h:959:14:   required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Tp = std::pair<int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
/usr/include/c++/7/bits/stl_algobase.h:993:32:   required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Tp = std::pair<int, long long int>]'
factories.cpp:132:69:   required from here
/usr/include/c++/7/bits/predefined_ops.h:65:22: error: no match for 'operator<' (operand types are 'std::pair<int, int>' and 'const std::pair<int, long long int>')
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/stl_iterator.h:888:5: note: candidate: template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:888:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/stl_iterator.h:895:5: note: candidate: template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:895:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from factories.cpp:2:
/usr/include/c++/7/bits/regex.h:1429:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)
     operator<(const sub_match<_Bi_iter>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1429:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from factories.cpp:2:
/usr/include/c++/7/bits/regex.h:1349:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)
     operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1349:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from factories.cpp:2:
/usr/include/c++/7/bits/regex.h:1272:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)
     operator<(const sub_match<_Bi_iter>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1272:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from factories.cpp:2:
/usr/include/c++/7/bits/regex.h:1198:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)
     operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1198:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<int, long long int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from factories.cpp:2:
/usr/include/c++/7/bits/regex.h:1121:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)
     operator<(const sub_match<_Bi_iter>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1121:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from factories.cpp:2:
/usr/include/c++/7/bits/regex.h:1041:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)
     operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:1041:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/regex:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110,
                 from factories.cpp:2:
/usr/include/c++/7/bits/regex.h:962:5: note: candidate: template<class _BiIter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)
     operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
     ^~~~~~~~
/usr/include/c++/7/bits/regex.h:962:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/future:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105,
                 from factories.cpp:2:
/usr/include/c++/7/thread:281:3: note: candidate: bool std::operator<(std::thread::id, std::thread::id)
   operator<(thread::id __x, thread::id __y) noexcept
   ^~~~~~~~
/usr/include/c++/7/thread:281:3: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::thread::id'
In file included from /usr/include/c++/7/forward_list:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:104,
                 from factories.cpp:2:
/usr/include/c++/7/bits/forward_list.h:1391:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator<(const std::forward_list<_Tp, _Alloc>&, const std::forward_list<_Tp, _Alloc>&)
     operator<(const forward_list<_Tp, _Alloc>& __lx,
     ^~~~~~~~
/usr/include/c++/7/bits/forward_list.h:1391:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::forward_list<_Tp, _Alloc>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from factories.cpp:2:
/usr/include/c++/7/valarray:1186:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__less, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__less, _Tp>::result_type> std::operator<(const _Tp&, const std::valarray<_Tp>&)
 _DEFINE_BINARY_OPERATOR(<, __less)
 ^
/usr/include/c++/7/valarray:1186:1: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<int, long long int>' is not derived from 'const std::valarray<_Tp>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from factories.cpp:2:
/usr/include/c++/7/valarray:1186:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__less, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__less, _Tp>::result_type> std::operator<(const std::valarray<_Tp>&, const _Tp&)
 _DEFINE_BINARY_OPERATOR(<, __less)
 ^
/usr/include/c++/7/valarray:1186:1: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0,
                 from factories.cpp:2:
/usr/include/c++/7/valarray:1186:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__less, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__less, _Tp>::result_type> std::operator<(const std::valarray<_Tp>&, const std::valarray<_Tp>&)
 _DEFINE_BINARY_OPERATOR(<, __less)
 ^
/usr/include/c++/7/valarray:1186:1: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::valarray<_Tp>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from factories.cpp:2:
/usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__less, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
     ^
/usr/include/c++/7/bits/valarray_after.h:416:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<int, long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from factories.cpp:2:
/usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__less, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
     ^
/usr/include/c++/7/bits/valarray_after.h:416:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/7/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/7/bits/specfun.h:45,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from factories.cpp:2:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<int, int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
       { return *__it < __val; }
                ~~~~~~^~~~~~~
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from factories.cpp:2:
/usr/include/c++/7/bits/valarray_after.h:416:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__less, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__less, typename _Dom1::value_type>::result_type> std::operator<(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
     ^
/usr/include/c++/7/bits/valarray_after.h:416:5: note:   template argume