Submission #1214081

#TimeUsernameProblemLanguageResultExecution timeMemory
1214081noopRotating Lines (APIO25_rotate)C++20
Compilation error
0 ms0 KiB
#include "rotate.h" #include <vector> void energy(int n, std::vector<int> v){ vector<pair<int,int>> v2(n); for (int i=0; i<n; i++){ v2[i]={v1[i],i}; } sort(v2.begin(),v2.end()); for (int i=0; i<n>>1; i++){ pair<int,int> target=v2[i+(n>>1)]; rotate({target.second},(v2[i].first+25000)%50000-target.first); } }

Compilation message (stderr)

rotate.cpp: In function 'void energy(int, std::vector<int>)':
rotate.cpp:5:12: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    5 |     vector<pair<int,int>> v2(n);
      |            ^~~~
      |            std::pair
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/vector:60,
                 from rotate.h:1,
                 from rotate.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
rotate.cpp:5:5: error: 'vector' was not declared in this scope
    5 |     vector<pair<int,int>> v2(n);
      |     ^~~~~~
rotate.cpp:5:5: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from rotate.h:1,
                 from rotate.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from rotate.h:1,
                 from rotate.cpp:1:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
rotate.cpp:5:17: error: expected primary-expression before 'int'
    5 |     vector<pair<int,int>> v2(n);
      |                 ^~~
rotate.cpp:7:9: error: 'v2' was not declared in this scope; did you mean 'v'?
    7 |         v2[i]={v1[i],i};
      |         ^~
      |         v
rotate.cpp:7:16: error: 'v1' was not declared in this scope; did you mean 'v'?
    7 |         v2[i]={v1[i],i};
      |                ^~
      |                v
rotate.cpp:9:10: error: 'v2' was not declared in this scope; did you mean 'v'?
    9 |     sort(v2.begin(),v2.end());
      |          ^~
      |          v
rotate.cpp:9:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
    9 |     sort(v2.begin(),v2.end());
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/11/vector:62,
                 from rotate.h:1,
                 from rotate.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4863:5: note: 'std::sort' declared here
 4863 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
rotate.cpp:11:14: error: expected primary-expression before 'int'
   11 |         pair<int,int> target=v2[i+(n>>1)];
      |              ^~~
rotate.cpp:12:17: error: 'target' was not declared in this scope
   12 |         rotate({target.second},(v2[i].first+25000)%50000-target.first);
      |                 ^~~~~~