Submission #689731

# Submission time Handle Problem Language Result Execution time Memory
689731 2023-01-29T08:35:38 Z bdl Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include "art.h"
#include <algorithm>
#include <vector>
using namespace std;

void solve(int n) {
  vector<int> p(n);
  for (int i = 0; i < n; i++)
    p[i] = i + 1;
  vector<int> k(n);
  for (int i = 0; i < n; i++) {
    k[i] = publish(p);
    rotate(p.begin(), p.begin() + 1, p.end());
  }
  for (int i = 0; i < n; i++)
    p[(k[i] - k[(i + 1) % n] + n - 1) / 2] = i + 1;
  return p;
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:20:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   20 |   return p;
      |          ^
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) {
      |        ~~~~~~~~~^~~~