Submission #993603

# Submission time Handle Problem Language Result Execution time Memory
993603 2024-06-06T07:48:28 Z MarwenElarbi Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
const int nax=3e5+5;

void solve(int N){
  int n=N;
  vector<int> tab(n,-1);
  int x=-1;
  deque<int> dq;
  for (int i = 0; i < n; ++i)
  {
    dq.push_back(i+1);
  }
  int ans=-1;
  for (int i = 0; i < N; ++i)
  {
      vector<int> cur;
      for (int j = 0; j < N; ++j)
      {
         cur.pb(dq[j]);
      }
      int x=dq.back();
      dq.pop_back();
      dq.push_front(x);
      int a=publish(cur);
      if(ans==-1){
        ans=a;
        continue;
      }
      tab[(n-1+a-ans)/2]=n-i+1;
      ans=a;
  }
  for (int i = 0; i < n; ++i)
  {
    if(tab[i]==-1) tab[i]=1;
  }
  answer(tab);
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:29:13: error: 'publish' was not declared in this scope
   29 |       int a=publish(cur);
      |             ^~~~~~~
art.cpp:41:3: error: 'answer' was not declared in this scope
   41 |   answer(tab);
      |   ^~~~~~
art.cpp:12:7: warning: unused variable 'x' [-Wunused-variable]
   12 |   int x=-1;
      |       ^
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) {
      |        ~~~~~~~~~^~~~