Submission #1286801

#TimeUsernameProblemLanguageResultExecution timeMemory
1286801SmuggingSpunRotating Lines (APIO25_rotate)C++20
Compilation error
0 ms0 KiB
#include "rotate.h" #include<bits/stdc++.h> using namespace std; const int MOD = 5e4; void energy(int n, vector<int>v){ if(n == 2){ rotate({0}, (v[1] + (MOD >> 1) - v[0] + MOD) % MOD); return; } if(*max_element(v.begin(), v.end()) < (MOD >> 1)){ vector<int>p(n); iota(p.begin(), p.end(), 0); sort(p.begin(), p.end(), [&] (int i, int j){ return v[i] < v[j]; }); for(int i = 0; i < (n >> 1); i++){ rotate({p[i]}, MOD - v[p[i]]); rotate({p[n - i - 1], (MOD >> 1) - v[p[i]]}); } return; } }

Compilation message (stderr)

rotate.cpp: In function 'void energy(int, std::vector<int>)':
rotate.cpp:18:31: error: no matching function for call to 'rotate(<brace-enclosed initializer list>)'
   18 |                         rotate({p[n - i - 1], (MOD >> 1) - v[p[i]]});
      |                         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from rotate.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:1390:5: note: candidate: 'template<class _FIter> constexpr _FIter std::_V2::rotate(_FIter, _FIter, _FIter)'
 1390 |     rotate(_ForwardIterator __first, _ForwardIterator __middle,
      |     ^~~~~~
/usr/include/c++/13/bits/stl_algo.h:1390:5: note:   template argument deduction/substitution failed:
rotate.cpp:18:31: note:   candidate expects 3 arguments, 1 provided
   18 |                         rotate({p[n - i - 1], (MOD >> 1) - v[p[i]]});
      |                         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:73:
/usr/include/c++/13/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++/13/pstl/glue_algorithm_defs.h:260:1: note:   template argument deduction/substitution failed:
rotate.cpp:18:31: note:   candidate expects 4 arguments, 1 provided
   18 |                         rotate({p[n - i - 1], (MOD >> 1) - v[p[i]]});
      |                         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from rotate.cpp:1:
rotate.h:4:6: note: candidate: 'void rotate(std::vector<int>, int)'
    4 | void rotate(std::vector<int> t, int x);
      |      ^~~~~~
rotate.h:4:6: note:   candidate expects 2 arguments, 1 provided