Submission #1157136

#TimeUsernameProblemLanguageResultExecution timeMemory
1157136the_ZHERArt Collections (BOI22_art)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "art.h" using namespase std; void solve(int N){ vector<int>v; int pos[5000]; for(int i=1;i<=n;i++){ v.push_back(i); pos[i]=i-1; } vector<int>ans; int was[5000]; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(was[j]==1){ continue; } pos[v[0]]=pos[j]; swap(v[pos[j]],v[0]); pos[j]=0; int x=publish(v); if(x==n-i){ ans.push_back(j); } pos[v[0]]=n-i; pos[v[n-i]]=0; swap(v[0],v[n-i]); } } answer(v); }

Compilation message (stderr)

art.cpp:3:7: error: expected nested-name-specifier before 'namespase'
    3 | using namespase std;
      |       ^~~~~~~~~
art.cpp: In function 'void solve(int)':
art.cpp:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int>v;
      |     ^~~~~~
art.cpp:5:5: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from art.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 /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from art.cpp:1:
/usr/include/c++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
art.cpp:5:12: error: expected primary-expression before 'int'
    5 |     vector<int>v;
      |            ^~~
art.cpp:7:20: error: 'n' was not declared in this scope
    7 |     for(int i=1;i<=n;i++){
      |                    ^
art.cpp:8:9: error: 'v' was not declared in this scope
    8 |         v.push_back(i);
      |         ^
art.cpp:11:12: error: expected primary-expression before 'int'
   11 |     vector<int>ans;
      |            ^~~
art.cpp:13:20: error: 'n' was not declared in this scope
   13 |     for(int i=1;i<=n;i++){
      |                    ^
art.cpp:18:17: error: 'v' was not declared in this scope
   18 |             pos[v[0]]=pos[j];
      |                 ^
art.cpp:19:13: error: 'swap' was not declared in this scope
   19 |             swap(v[pos[j]],v[0]);
      |             ^~~~
art.cpp:19:13: note: suggested alternatives:
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from art.cpp:1:
/usr/include/c++/11/bits/regex.h:2165:5: note:   'std::__cxx11::swap'
 2165 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from art.cpp:1:
/usr/include/c++/11/bits/move.h:196:5: note:   'std::swap'
  196 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/11/bits/move.h:196:5: note:   'std::swap'
In file included from /usr/include/c++/11/compare:39,
                 from /usr/include/c++/11/bits/stl_pair.h:65,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from art.cpp:1:
/usr/include/c++/11/concepts:227:43: note:   'std::ranges::__cust::swap'
  227 |       inline constexpr __cust_swap::_Swap swap{};
      |                                           ^~~~
In file included from /usr/include/c++/11/exception:153,
                 from /usr/include/c++/11/ios:39,
                 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 art.cpp:1:
/usr/include/c++/11/bits/exception_ptr.h:223:5: note:   'std::__exception_ptr::swap'
  223 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
In file included from /usr/include/c++/11/filesystem:45,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
                 from art.cpp:1:
/usr/include/c++/11/bits/fs_path.h:692:15: note:   'std::filesystem::__cxx11::swap'
  692 |   inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
      |               ^~~~
In file included from /usr/include/c++/11/compare:39,
                 from /usr/include/c++/11/bits/stl_pair.h:65,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from art.cpp:1:
/usr/include/c++/11/concepts:167:35: note:   'std::ranges::__cust_swap::swap'
  167 |       template<typename _Tp> void swap(_Tp&, _Tp&) = delete;
      |                                   ^~~~
art.cpp:23:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |                 ans.push_back(j);
      |                 ^~~
      |                 abs
art.cpp:30:12: error: 'v' was not declared in this scope
   30 |     answer(v);
      |            ^