Submission #135743

#TimeUsernameProblemLanguageResultExecution timeMemory
135743random0029Aliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
// ItnoE
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct CHT
{
	typedef pair < ll , ll > Line;
	vector < pair < ll , pair < Line , ll > > > A;
	ll INF = (ll)1e18;
	inline void Clear()
	{
		A.clear();
	}
	inline void Add(Line X, ll id)
	{
		while (A.size() && Intersection(A.back().second.first, X) <= A.back().first)
			A.pop_back();
		if (A.size())
			A.push_back({Intersection(A.back().second.first, X), {X, id}});
		else
			A.push_back({-INF, {X, id}});
	}
	inline pair < ll , ll > GetMax(ll X)
	{
		int lb = upper_bound(A.begin(), A.end(), pair < ll , pair < Line , ll > > {X, {{INF, INF}, -1}}) - A.begin() - 1;
		return (make_pair(A[lb].second.first.first * X + A[lb].second.first.second, A[lb].second.second));
	}
	inline ll Intersection(Line X, Line Y)
	{
		if (X.first == Y.first && X.second <= Y.second)
			return (-INF);
		if (X.first == Y.first)
			return (INF);
		return ((X.second - Y.second) / (Y.first - X.first)) + ((X.second - Y.second) % (Y.first - X.first) > 0);
	}
};
const int N = 100005, MXM = 1e6 + 10;
int n, m, A[N], B[N], F[N], MN[MXM];
pair < ll , ll > dp[N];
inline ll SQR(ll a) {return (a * a);}
inline pair < ll , ll > Solve(ll md)
{
	CHT C;
	dp[0] = {0, 0};
	for (int i = 1; i <= n; i ++)
	{
		ll vl = dp[i - 1] + SQR(F[i]);
		if (i > 1 && B[i - 1] > F[i])
			vl -= SQR(B[i - 1] - F[i]);
		if (vl <= (ll)(1e16))
			C.Add({F[i], - vl}, i);
		auto tt = C.GetMax(2 * B[i]);
		tt.first *= -1;
		dp[i].first = tt.first + SQR(B[i]) + md;
		dp[i].second = dp[tt.second - 1].second;
	}
	return (dp[n]);
}
int64_t take_photos(int q, int mm, int k, vector < int > RG, vector < int > CG)
{
	m = mm;
	memset(MN, 63, sizeof(MN));
	for (int i = 0; i < q; i ++)
	{
		if (RG[i] > CG[i])
			swap(RG[i], CG[i]);
		MN[CG[i]] = min(MN[CG[i]], RG[i]);
	}
	for (int i = 0; i < m; i ++)
		if (MN[i] <= i)
		{
			int b = i, a = i - MN[i] + 1;
			while (n && B[n] - A[n] >= b - a)
				n --;
			n ++; B[n] = b; A[n] = a;
			F[n] = B[n] - A[n];
		}

	ll le = 0, ri = (ll)m * m + 1, md;
	while (ri - le > 1)
	{
		md = (le + ri) >> 1;
		auto X = Solve(md);
		if (X.second <= k)
			ri = md;
		else
			le = md;
	}
	ll res = Solve(ri).first - ri * k;
	return (res);




	/*CHT C;
	  ll dp[k + 5][n + 5];
	  memset(dp, 63, sizeof(dp));
	  for (int i = 0; i <= k; i ++)
	  dp[i][0] = 0;
	  k = min(k, n);
	  for (int j = 1; j <= k; j ++)
	  {
	  C.Clear();
	  for (int i = 1; i <= n; i ++)
	  {
	  ll vl = dp[j - 1][i - 1] + SQR(F[i]);
	  if (i > 1 && B[i - 1] > F[i])
	  vl -= SQR(B[i - 1] - F[i]);
	  if (vl <= (ll)(1e16))
	  C.Add({F[i], - vl});
	  dp[j][i] = min(dp[j - 1][i], -C.GetMax(2 * B[i]) + SQR(B[i]));
	  }
	  }*/

	/*for (int j = 1; j <= k; j ++)
	  {
	  for (int i = 1; i <= n; i ++)
	  {
	  dp[j][i] = dp[j - 1][i];
	  for (int h = 1; h <= i; h ++)
	  {
	  ll vl = dp[j - 1][h - 1];
	  vl += SQR(B[i] - B[h] + A[h]);
	  if (h > 1 && B[h - 1] > B[h] - A[h])
	  vl -= SQR(B[h - 1] - (B[h] - A[h]));
	  dp[j][i] = min(dp[j][i], vl);
	  }
	  }
	  }*/

	//return (dp[k][n]);
}
/*int main()
  {
  int q = 2;//5;
  int mm = 6;//7;
  int k = 2;
  vector < int > _R = {1, 4};//{0, 4, 4, 4, 4};
  vector < int > _C = {4, 1};//{3, 4, 6, 5, 6};
  ll Res = take_photos(q, mm, k, _R, _C);
  cout << Res << endl;
  }*/

Compilation message (stderr)

aliens.cpp: In function 'std::pair<long long int, long long int> Solve(ll)':
aliens.cpp:47:21: error: no match for 'operator+' (operand types are 'std::pair<long long int, long long int>' and 'll {aka long long int}')
   ll vl = dp[i - 1] + SQR(F[i]);
           ~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/stl_iterator.h:397:5: note: candidate: template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)
     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:397:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'll {aka long long int}'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/stl_iterator.h:1198:5: note: candidate: template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)
     operator+(typename move_iterator<_Iterator>::difference_type __n,
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:1198:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'll {aka long long int}'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5876:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5876:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:53:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.tcc:1157:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(const _CharT* __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.tcc:1157:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   mismatched types 'const _CharT*' and 'std::pair<long long int, long long int>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:53:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.tcc:1173:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.tcc:1173:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'll {aka long long int}'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5913:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5913:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5929:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5929:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5941:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5941:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5947:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5947:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5953:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5953:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5965:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const _CharT* __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5965:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   mismatched types 'const _CharT*' and 'std::pair<long long int, long long int>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5971:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(_CharT __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5971:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'll {aka long long int}'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5977:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5977:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 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 aliens.cpp:2:
/usr/include/c++/7/bits/basic_string.h:5983:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^~~~~~~~
/usr/include/c++/7/bits/basic_string.h:5983:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from aliens.cpp:2:
/usr/include/c++/7/complex:326:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const std::complex<_Tp>&)
     operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:326:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'const std::complex<_Tp>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from aliens.cpp:2:
/usr/include/c++/7/complex:335:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const std::complex<_Tp>&, const _Tp&)
     operator+(const complex<_Tp>& __x, const _Tp& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:335:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   'std::pair<long long int, long long int>' is not derived from 'const std::complex<_Tp>'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from aliens.cpp:2:
/usr/include/c++/7/complex:344:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator+(const _Tp&, const std::complex<_Tp>&)
     operator+(const _Tp& __x, const complex<_Tp>& __y)
     ^~~~~~~~
/usr/include/c++/7/complex:344:5: note:   template argument deduction/substitution failed:
aliens.cpp:47:31: note:   mismatched types 'const std::complex<_Tp>' and 'll {aka long long int}'
   ll vl = dp[i - 1] + SQR(F[i]);
                               ^
In file included from /usr/include/c++/7/ccomplex:39:0,