Submission #720907

# Submission time Handle Problem Language Result Execution time Memory
720907 2023-04-09T18:12:21 Z YENGOYAN Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
#include "art.h"
#include <vector>
#include <algorithm>
#include <cmath>

void solve(int N) {
//    std::vector<int> order = {1, 2, 3};
  //  publish(order);
  //  order = {2, 3, 1};
  //  publish(order);
  //  order = {1, 3, 2};
  //  answer(order);
  int n = N;
  vector<int> v(n);
  for(int i = 0; i < n; ++i){
    v[i] = i + 1;
  }
  int l1 = publish(v), c = n;
  vector<int> ans(n);
  for(int i = 0; i < n - 1; ++i){
    v.insert(v.begin(), v.back());
    v.pop_back();
    int l2 = publish(v);
    ans[(l2 - l1 + n - 1) / 2] = --c;
    l1 = l2;
  }
  for(int i = 0; i < n; ++i){
    if(!ans[i]) {
      ans[i] = 1;
    }
  }
  answer(ans);
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:14:3: error: 'vector' was not declared in this scope
   14 |   vector<int> v(n);
      |   ^~~~~~
art.cpp:14:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from art.h:1,
                 from art.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from art.h:1,
                 from art.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
art.cpp:14:10: error: expected primary-expression before 'int'
   14 |   vector<int> v(n);
      |          ^~~
art.cpp:16:5: error: 'v' was not declared in this scope
   16 |     v[i] = i + 1;
      |     ^
art.cpp:18:20: error: 'v' was not declared in this scope
   18 |   int l1 = publish(v), c = n;
      |                    ^
art.cpp:19:10: error: expected primary-expression before 'int'
   19 |   vector<int> ans(n);
      |          ^~~
art.cpp:24:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |     ans[(l2 - l1 + n - 1) / 2] = --c;
      |     ^~~
      |     abs
art.cpp:24:36: error: 'c' was not declared in this scope
   24 |     ans[(l2 - l1 + n - 1) / 2] = --c;
      |                                    ^
art.cpp:28:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     if(!ans[i]) {
      |         ^~~
      |         abs
art.cpp:32:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |   answer(ans);
      |          ^~~
      |          abs
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~