답안 #714392

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
714392 2023-03-24T10:09:41 Z vjudge1 Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
//#include "art.h"


#define ll long long
#define pii pair<int, int>

using namespace std;

int n;


bool comp(int a, int b){
    if(a == b) return true;
    vector<int> v = {a, b};
    for (int i = 1; i <= n; i++)
    {
        if(a == i || b == i) continue;
        v.emplace_back(i);
    }
    int p1 = publish(v);
    swap(v[0], v[1]);
    int p2 = publish(v);
    return p1 > p2;
}


void solve(int N){
    n = N;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        v[i] = i + 1;
    }
    vector<int> ans(n);
    for (int i = 1; i <= (n / 2) + (n % 2); i++)
    {
        v.erase(v.begin() + (i - 1));
        v.insert(v.begin(), i);
        int p1 = publish(v);
        
        v.erase(v.begin());
        v.push_back(i);
        int p2 = publish(v);

        v.pop_back();
        v.insert(v.begin() + (i - 1), i);
        int pos = n - (n - 1 + abs(p1 - p2)) / 2;
        if(comp(i, n - i + 1)){
            ans[pos - 1] = i;
            ans[n - pos] = n - i + 1;
        }
        else{
            ans[pos - 1] = n - i + 1;
            ans[n - pos] = i;
        }
    }
    answer(ans);
}

Compilation message

art.cpp: In function 'bool comp(int, int)':
art.cpp:21:14: error: 'publish' was not declared in this scope
   21 |     int p1 = publish(v);
      |              ^~~~~~~
art.cpp: In function 'void solve(int)':
art.cpp:40:18: error: 'publish' was not declared in this scope
   40 |         int p1 = publish(v);
      |                  ^~~~~~~
art.cpp:58:5: error: 'answer' was not declared in this scope
   58 |     answer(ans);
      |     ^~~~~~
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) {
      |        ~~~~~~~~~^~~~