Detalii evaluare #63387882

Rezumat problemă

Fie a = (a[1], a[2], ..., a[n]) un șir de n numere întregi. Pentru fiecare k ∈ {1,2, ...,n}, definim min[k] = min{a[1], a[2], ... ,a[k]} și max[k] = max{a[1], a[2], ...,a[k]}. Astfel, asociem șirului a un alt șir de intervale închise minmax = ([min[1], max[1]], [min[2], max[2]], ..., [min[n], max[n]]). Vom spune că șirul a este un șir cromatic dacă și numai dacă elementele șirului minmax sunt distincte două câte două, adică nu există două intervale identice în șir. Dându-se un șir a, nu neapărat cromatic, să se determine:

  • Numărul de șiruri cromatice NSC ce se pot forma prin rearanjarea elementelor șirului a. Întrucât acest număr poate fi foarte mare, se cere NSC modulo 1.000.000.007.
  • Știind că șirul a este cromatic, să se determine poziția p ∈ {1, 2, ..., NSC} a șirului a în lista ordonată lexicografic a tuturor permutărilor cromatice ale lui a.
  • Dat fiind q ∈ {1, 2, ..., NSC}, să se determine cel de-al q-lea șir cromatic în ordine lexicografică ce se poate obține prin rearanjarea elementelor șirului a.
OJI 2025, clasele 11-12
Fișiere Pracsiu Dan (dnprx) Szabo Zoltan concurs

Detalii

Problema cromatic Operații I/O cromatic.in/cromatic.out
Limita timp 1.5 secunde Limita memorie Total: 256 MB / Stivă 64 MB
Id soluție #63387882 Utilizator Hustiu Teodor (teohustiu)
Fișier cromatic.cpp Dimensiune 8.17 KB
Data încărcării 01 Martie 2026, 13:41 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

cromatic.cpp: In constructor 'Comb::Comb(int)':
cromatic.cpp:29:46: error: no matching function for call to 'pow(__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type&, int, const int&)'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
cromatic.cpp:29:46: note: candidates are:
In file included from /usr/include/features.h:374:0,
                 from /usr/include/assert.h:35,
                 from /usr/include/c++/4.8/cassert:43,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:33,
                 from cromatic.cpp:15:
/usr/include/i386-linux-gnu/bits/mathcalls.h:153:1: note: double pow(double, double)
 __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
/usr/include/i386-linux-gnu/bits/mathcalls.h:153:1: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const _Tp&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const std::valarray<_Tp>&, const _Tp&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::valarray<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const std::valarray<_Tp>&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::valarray<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const std::valarray<typename _Dom::valarray>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::valarray<typename _Dom::valarray>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1871:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const std::complex<_Tp>&, const std::complex<_Up>&)
     pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/4.8/complex:1871:5: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1863:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const _Tp&, const std::complex<_Up>&)
     pow(const _Tp& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/4.8/complex:1863:5: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::complex<_Up>' and 'int'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1855:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const std::complex<_Tp>&, const _Up&)
     pow(const std::complex<_Tp>& __x, const _Up& __y)
     ^
/usr/include/c++/4.8/complex:1855:5: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1034:5: note: template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const std::complex<_Tp>&)
     pow(const _Tp& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/4.8/complex:1034:5: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::complex<_Tp>' and 'int'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1023:5: note: template<class _Tp> std::complex<_Tp> std::pow(const std::complex<_Tp>&, const std::complex<_Tp>&)
     pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/4.8/complex:1023:5: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:989:5: note: template<class _Tp> std::complex<_Tp> std::pow(const std::complex<_Tp>&, const _Tp&)
     pow(const complex<_Tp>& __x, const _Tp& __y)
     ^
/usr/include/c++/4.8/complex:989:5: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:41:0,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/cmath:434:5: note: template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^
/usr/include/c++/4.8/cmath:434:5: note:   template argument deduction/substitution failed:
cromatic.cpp:29:46: note:   candidate expects 2 arguments, 3 provided
         inv_fact[N] = pow(fact[N], MOD-2, MOD);

                                              ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:41:0,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/cmath:411:3: note: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^
/usr/include/c++/4.8/cmath:411:3: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/4.8/cmath:407:3: note: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^
/usr/include/c++/4.8/cmath:407:3: note:   candidate expects 2 arguments, 3 provided
cromatic.cpp: In function 'int countNSC(const std::vector<int>&, int)':
cromatic.cpp:50:29: error: no matching function for call to 'pow(long long int, int, const int&)'
     return pow(2LL, n-1, MOD);

                             ^
cromatic.cpp:50:29: note: candidates are:
In file included from /usr/include/features.h:374:0,
                 from /usr/include/assert.h:35,
                 from /usr/include/c++/4.8/cassert:43,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:33,
                 from cromatic.cpp:15:
/usr/include/i386-linux-gnu/bits/mathcalls.h:153:1: note: double pow(double, double)
 __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
/usr/include/i386-linux-gnu/bits/mathcalls.h:153:1: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const _Tp&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const std::valarray<_Tp>&, const _Tp&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::valarray<_Tp>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const std::valarray<_Tp>&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::valarray<_Tp>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const std::valarray<typename _Dom::valarray>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::valarray<typename _Dom::valarray>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1871:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const std::complex<_Tp>&, const std::complex<_Up>&)
     pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/4.8/complex:1871:5: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1863:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const _Tp&, const std::complex<_Up>&)
     pow(const _Tp& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/4.8/complex:1863:5: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::complex<_Up>' and 'int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1855:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const std::complex<_Tp>&, const _Up&)
     pow(const std::complex<_Tp>& __x, const _Up& __y)
     ^
/usr/include/c++/4.8/complex:1855:5: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1034:5: note: template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const std::complex<_Tp>&)
     pow(const _Tp& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/4.8/complex:1034:5: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::complex<_Tp>' and 'int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1023:5: note: template<class _Tp> std::complex<_Tp> std::pow(const std::complex<_Tp>&, const std::complex<_Tp>&)
     pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/4.8/complex:1023:5: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:989:5: note: template<class _Tp> std::complex<_Tp> std::pow(const std::complex<_Tp>&, const _Tp&)
     pow(const complex<_Tp>& __x, const _Tp& __y)
     ^
/usr/include/c++/4.8/complex:989:5: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:41:0,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/cmath:434:5: note: template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^
/usr/include/c++/4.8/cmath:434:5: note:   template argument deduction/substitution failed:
cromatic.cpp:50:29: note:   candidate expects 2 arguments, 3 provided
     return pow(2LL, n-1, MOD);

                             ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:41:0,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/cmath:411:3: note: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^
/usr/include/c++/4.8/cmath:411:3: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/4.8/cmath:407:3: note: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^
/usr/include/c++/4.8/cmath:407:3: note:   candidate expects 2 arguments, 3 provided
cromatic.cpp: In function 'long long int positionOfPermutation(const std::vector<int>&, const std::vector<int>&, int)':
cromatic.cpp:98:70: error: 'comb' was not declared in this scope
                 comb(remaining_left+remaining_right-1, remaining_left);

                                                                      ^
cromatic.cpp:107:70: error: 'comb' was not declared in this scope
                 comb(remaining_left+remaining_right-1, remaining_left);

                                                                      ^
cromatic.cpp:90:13: warning: unused variable 'cnt_min' [-Wunused-variable]
         int cnt_min = 0;

             ^
cromatic.cpp: In function 'std::vector<int> kthPermutation(const std::vector<int>&, long long int, int)':
cromatic.cpp:139:43: error: 'comb' was not declared in this scope
         long long ways_min = comb(L+R-1, L);   // all remaining left elements will become minima

                                           ^
cromatic.cpp:141:19: warning: unused variable 'ways_max' [-Wunused-variable]
         long long ways_max = comb(L+R-1, R);

                   ^
cromatic.cpp: In function 'int main()':
cromatic.cpp:178:36: error: no matching function for call to 'pow(long long int, int, const int&)'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
cromatic.cpp:178:36: note: candidates are:
In file included from /usr/include/features.h:374:0,
                 from /usr/include/assert.h:35,
                 from /usr/include/c++/4.8/cassert:43,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:33,
                 from cromatic.cpp:15:
/usr/include/i386-linux-gnu/bits/mathcalls.h:153:1: note: double pow(double, double)
 __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 ^
/usr/include/i386-linux-gnu/bits/mathcalls.h:153:1: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_Constant, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const _Tp&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_Constant, _Tp, _Tp>, _Tp> std::pow(const std::valarray<_Tp>&, const _Tp&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::valarray<_Tp>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_ValArray, _Tp, _Tp>, _Tp> std::pow(const std::valarray<_Tp>&, const std::valarray<_Tp>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::valarray<_Tp>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename _Dom::value_type> std::pow(const std::valarray<typename _Dom::valarray>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::valarray<typename _Dom::valarray>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename _Dom::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/valarray:587:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::_Pow, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename _Dom1::value_type> std::pow(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)
 _DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow)
 ^
/usr/include/c++/4.8/bits/valarray_after.h:544:1: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1871:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const std::complex<_Tp>&, const std::complex<_Up>&)
     pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/4.8/complex:1871:5: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1863:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const _Tp&, const std::complex<_Up>&)
     pow(const _Tp& __x, const std::complex<_Up>& __y)
     ^
/usr/include/c++/4.8/complex:1863:5: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::complex<_Up>' and 'int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1855:5: note: template<class _Tp, class _Up> std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type> std::pow(const std::complex<_Tp>&, const _Up&)
     pow(const std::complex<_Tp>& __x, const _Up& __y)
     ^
/usr/include/c++/4.8/complex:1855:5: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1034:5: note: template<class _Tp> std::complex<_Tp> std::pow(const _Tp&, const std::complex<_Tp>&)
     pow(const _Tp& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/4.8/complex:1034:5: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::complex<_Tp>' and 'int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:1023:5: note: template<class _Tp> std::complex<_Tp> std::pow(const std::complex<_Tp>&, const std::complex<_Tp>&)
     pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
     ^
/usr/include/c++/4.8/complex:1023:5: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/c++/4.8/ccomplex:38:0,
                 from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/complex:989:5: note: template<class _Tp> std::complex<_Tp> std::pow(const std::complex<_Tp>&, const _Tp&)
     pow(const complex<_Tp>& __x, const _Tp& __y)
     ^
/usr/include/c++/4.8/complex:989:5: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:41:0,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/cmath:434:5: note: template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
     pow(_Tp __x, _Up __y)
     ^
/usr/include/c++/4.8/cmath:434:5: note:   template argument deduction/substitution failed:
cromatic.cpp:178:36: note:   candidate expects 2 arguments, 3 provided
             cout<<pow(2LL, n-1, MOD)<<"\n";

                                    ^
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:41:0,
                 from cromatic.cpp:15:
/usr/include/c++/4.8/cmath:411:3: note: constexpr long double std::pow(long double, long double)
   pow(long double __x, long double __y)
   ^
/usr/include/c++/4.8/cmath:411:3: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/4.8/cmath:407:3: note: constexpr float std::pow(float, float)
   pow(float __x, float __y)
   ^
/usr/include/c++/4.8/cmath:407:3: note:   candidate expects 2 arguments, 3 provided
cromatic.cpp:199:46: error: 'comb' was not declared in this scope
                 add += comb(remL+remR-1, remL);

                                              ^
cromatic.cpp:204:46: error: 'comb' was not declared in this scope
                 add += comb(remL+remR-1, remL);

                                              ^
cromatic.cpp:207:22: error: 'sorted_a' was not declared in this scope
             if(cur < sorted_a[l_ptr]){ l_ptr++; L--; }

                      ^
cromatic.cpp:218:49: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
         vector<int> res = kthPermutation(a, p, n);

                                                 ^
cromatic.cpp:129:13: error: in passing argument 1 of 'std::vector<int> kthPermutation(const std::vector<int>&, long long int, int)'
 vector<int> kthPermutation(const vector<int>& sorted_a,

             ^
cromatic.cpp: In function 'int countNSC(const std::vector<int>&, int)':
cromatic.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
 }

 ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema cromatic face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.

Du-te sus!