# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1248093 | alexdd | Rotating Lines (APIO25_rotate) | C++20 | Compilation error | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 50000;
void energy(int n, vector<int> v)
{
for(int i=0;i<n/2;i++)
{
///v[i] + x = 0
///x = -v[i]
rotate({i}, (MOD - v[i])%MOD);
}
for(int i=n/2;i<n;i++)
{
///v[i] + x = 25000
///x = 25000 - v[i]
rotate({i}, (25000 - v[i] + MOD)%MOD);
}
}
Compilation message (stderr)
rotate.cpp: In function 'void energy(int, std::vector<int>)': rotate.cpp:10:15: error: no matching function for call to 'rotate(<brace-enclosed initializer list>, int)' 10 | rotate({i}, (MOD - v[i])%MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from rotate.cpp:1: /usr/include/c++/11/bits/stl_algo.h:1405:5: note: candidate: 'template<class _FIter> constexpr _FIter std::_V2::rotate(_FIter, _FIter, _FIter)' 1405 | rotate(_ForwardIterator __first, _ForwardIterator __middle, | ^~~~~~ /usr/include/c++/11/bits/stl_algo.h:1405:5: note: template argument deduction/substitution failed: rotate.cpp:10:15: note: candidate expects 3 arguments, 2 provided 10 | rotate({i}, (MOD - v[i])%MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from rotate.cpp:1: /usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator)' 260 | rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last); | ^~~~~~ /usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note: template argument deduction/substitution failed: rotate.cpp:10:15: note: candidate expects 4 arguments, 2 provided 10 | rotate({i}, (MOD - v[i])%MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ rotate.cpp:16:15: error: no matching function for call to 'rotate(<brace-enclosed initializer list>, int)' 16 | rotate({i}, (25000 - v[i] + MOD)%MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/string:52, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from rotate.cpp:1: /usr/include/c++/11/bits/stl_algo.h:1405:5: note: candidate: 'template<class _FIter> constexpr _FIter std::_V2::rotate(_FIter, _FIter, _FIter)' 1405 | rotate(_ForwardIterator __first, _ForwardIterator __middle, | ^~~~~~ /usr/include/c++/11/bits/stl_algo.h:1405:5: note: template argument deduction/substitution failed: rotate.cpp:16:15: note: candidate expects 3 arguments, 2 provided 16 | rotate({i}, (25000 - v[i] + MOD)%MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from rotate.cpp:1: /usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator)' 260 | rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last); | ^~~~~~ /usr/include/c++/11/pstl/glue_algorithm_defs.h:260:1: note: template argument deduction/substitution failed: rotate.cpp:16:15: note: candidate expects 4 arguments, 2 provided 16 | rotate({i}, (25000 - v[i] + MOD)%MOD); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~