Submission #237938

# Submission time Handle Problem Language Result Execution time Memory
237938 2020-06-09T11:31:04 Z MrRobot_28 Usmjeri (COCI17_usmjeri) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int const1 = 1e9 + 7;
int power(int a, int b){
	if(b == 0)
	{
		return 1;
	}
	else if(b % 2 == 0){
		int t=  power(a, b / 2);
		return t * t % const1;
	}
	else
	{
		int t= power(a, b / 2);
		t = t * t % const1;
		return t * a % const1;
	}
}
vector <int> used;
vector <vector <pair <int, int> > > g;
vector <vector <int> > pred;
vector <int> tin, tout, h, h1;
int timer = 0;
bool pr(int a, int b)
{
	return tin[a] <= tin[b] && tout[a] >= tout[b];
}
void dfs(int v, int p = -1)
{
	tin[v] = timer++;
	for(int i = 0; i < g[v].size(); i++)
	{
		int to = g[v][i].first;
		if(to != p)
		{
			pred[0][to] = v;
			h[to] = h[v] + 1;
			dfs(to, v);
		}
	}
	tout[v] = timer++;
}
vector <vector <int> > g1;
vector <int> dsu, rang;
vector <pair <int, int> > vec;
int lca(int a, int b)
{
	if(pr(a, b))
	{
		for(int j = pred.size() - 1; j >= 0; j--)
		{
			if(!pr(pred[j][b], a))
			{
				b = pred[j][b];
			}
		}
		return pred[0][b];
	}
	else if(pr(b, a))
	{
		for(int j = pred.size() - 1; j >= 0; j--){
			if(!pr(pred[j][a], b))
			{
				a = pred[j][a];
			}
		}
		return pred[0][a];
	}
	else
	{
		for(int j = pred.size() - 1; j >= 0; j--)
		{
			if(!pr(pred[j][a], b))
			{
				a = pred[j][a];
			}
		}
		for(int j = pred.size() - 1; j >= 0; j--)
		{
			if(!pr(pred[j][b], a))
			{
				b = pred[j][b];
			}
		}
		int v = pred[0][a];
		int ind1 = lower_bound(g[v].begin(), g[v].end(), make_pair(a, 0)) - g[v].begin();
		int ind2 = lower_bound(g[v].begin(), g[v].end(), make_pair(b, 0)) - g[v].begin();
		ind1 = g[v][ind1].second;
		ind2 = g[v][ind2].second;
		vec.push_back({ind1, ind2});
		return pred[0][a];
	}
}
int qwer(int a)
{
	if(a == dsu[a])
	{
		return a;
	}
	else
	{
		return dsu[a] = qwer(dsu[a]);
	}
}
void unite(int a, int b)
{
	a = qwer(a);
	b = qwer(b);
	if(a != b)
	{
		if(rang[a] < rang[b])
		{
			swap(a, b);
		}
		dsu[b] = a;
		if(rang[a] == rang[b])
		{
			rang[a]++;
		}
	}
}
void dfs1(int v, int p = -1, int pind = -1)
{
	for(int i = 0; i < g[v].size(); i++){
		int to = g[v][i].first;
		if(to != p)
		{
			dfs1(to, v, g[v][i].second);
			if(h1[to] < h[v])
			{
				unite(pind, g[v][i].second);
			}
			h1[v] = min(h1[v], h1[to]);
		}
	}
}
void dfs2(int v, int c)
{
	used[v] = c;
	for(int i = 0; i < g1[v].size(); i++)
	{
		int to = g1[v][i];
		if(used[to] == -1)
		{
			dfs2(to, 1 - c);
		}
		else if(used[to] != 1 - c)
		{
			cout << 0;
			exit(0);
		}
	}
}
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, m;
	cin >> n >> m;
	if(n == 1)
	{
		cout << 2;
		return 0;
	}
	g1.resize(n - 1);
	dsu.resize(n - 1);
	rang.resize(n - 1);
	g.resize(n);
	h.resize(n);
	h1.resize(n, 1e9);
	int t = log2(n) + 1;
	pred.resize(t, vector <int> (n));
	tin.resize(n);
	tout.resize(n);
	for(int i = 0; i < n - 1; i++)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		g[a].push_back({b, i});
		g[b].push_back({a, i});
	}
	for(int i = 0; i < n; i++){
		sort(g[i].begin(), g[i].end());
	}
	dfs(0);
	for(int j = 1; j < t; j++)
	{
		for(int i = 0; i < n; i++)
		{
			pred[j][i] = pred[j - 1][pred[j - 1][i]];
		}
	}
	for(int i = 0; i < n - 1; i++){
		dsu[i] = i;
		rang[i] = 1;
	}
	while(m--)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		if(a == b)
		{
			continue;
		}
		int v = lca(a, b);
		h1[a] = min(h1[a], h[v]);
		h1[b] = min(h1[b], h[v]);
	}
	dfs1(0);
	for(int i = 0; i < vec.size(); i++)
	{
		int a = vec[i].first;
		int b = vec[i].second; 
		a = qwer(a);
		b = qwer(b);
		g1[a].push_back(b);
		g1[b].push_back(a);
	}
	used.resize(n, -1);
	int cnt = 0;
	for(int i = 0; i < n - 1; i++)
	{
		int v = qwer(i);
		if(used[v] == -1)
		{
			cnt++;
			dfs2(v, 0);
		}
	}
	cout << power(2, cnt);
	return 0;
}

Compilation message

usmjeri.cpp: In function 'void dfs(long long int, long long int)':
usmjeri.cpp:33:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < g[v].size(); i++)
                 ~~^~~~~~~~~~~~~
usmjeri.cpp: In function 'void dfs1(long long int, long long int, long long int)':
usmjeri.cpp:126:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < g[v].size(); i++){
                 ~~^~~~~~~~~~~~~
usmjeri.cpp: In function 'void dfs2(long long int, long long int)':
usmjeri.cpp:142:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < g1[v].size(); i++)
                 ~~^~~~~~~~~~~~~~
usmjeri.cpp: In function 'int main()':
usmjeri.cpp:216:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < vec.size(); i++)
                 ~~^~~~~~~~~~~~
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 usmjeri.cpp:1:
/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<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Value = const std::pair<long long int, 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<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Tp = std::pair<long long int, 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<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Tp = std::pair<long long int, int>]'
usmjeri.cpp:88:67:   required from here
/usr/include/c++/7/bits/predefined_ops.h:65:22: error: no match for 'operator<' (operand types are 'std::pair<long long int, long long int>' and 'const std::pair<long long int, 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long int, long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long int, long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long int, long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long 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/future:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:105,
                 from usmjeri.cpp:1:
/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<long long int, long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long int, long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'std::pair<long long int, long long 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 usmjeri.cpp:1:
/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 usmjeri.cpp:1:
/usr/include/c++/7/bits/predefined_ops.h:65:22: note:   'const std::pair<long long 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 usmjeri.cpp:1:
/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::