Submission #1324843

#TimeUsernameProblemLanguageResultExecution timeMemory
1324843exoworldgdRotating Lines (APIO25_rotate)C++20
Compilation error
0 ms0 KiB
#include"rotate.h" #include<bits/stdc++.h> #define exoworldgd cin.tie(0)->sync_with_stdio(0),cout.tie(0) #define ll long long using namespace std; void energy(int n,vector<int>v){ array<int,2>a[n]; for(int i=0;i<n;i++)a[i]={v[i],i}; sort(a,a+n); int m=n>>1,N=5e4; for(int i=m,x,y;i<n;i++)x=(a[i-m][1]+N/2)%N,y=(x+N-a[j][0])%N,rotate({a[j][1]},y),a[j][0]=x; }

Compilation message (stderr)

rotate.cpp: In function 'void energy(int, std::vector<int>)':
rotate.cpp:11:58: error: 'j' was not declared in this scope
   11 |     for(int i=m,x,y;i<n;i++)x=(a[i-m][1]+N/2)%N,y=(x+N-a[j][0])%N,rotate({a[j][1]},y),a[j][0]=x;
      |                                                          ^
rotate.cpp:11:73: error: no matching function for call to 'rotate(<brace-enclosed initializer list>, int&)'
   11 |     for(int i=m,x,y;i<n;i++)x=(a[i-m][1]+N/2)%N,y=(x+N-a[j][0])%N,rotate({a[j][1]},y),a[j][0]=x;
      |                                                                   ~~~~~~^~~~~~~~~~~~~
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:11:73: note:   candidate expects 3 arguments, 2 provided
   11 |     for(int i=m,x,y;i<n;i++)x=(a[i-m][1]+N/2)%N,y=(x+N-a[j][0])%N,rotate({a[j][1]},y),a[j][0]=x;
      |                                                                   ~~~~~~^~~~~~~~~~~~~
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:11:73: note:   candidate expects 4 arguments, 2 provided
   11 |     for(int i=m,x,y;i<n;i++)x=(a[i-m][1]+N/2)%N,y=(x+N-a[j][0])%N,rotate({a[j][1]},y),a[j][0]=x;
      |                                                                   ~~~~~~^~~~~~~~~~~~~
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:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>'
    4 | void rotate(std::vector<int> t, int x);
      |             ~~~~~~~~~~~~~~~~~^