답안 #689731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
689731 2023-01-29T08:35:38 Z bdl Art Collections (BOI22_art) C++17
컴파일 오류
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) {
      |        ~~~~~~~~~^~~~