답안 #1097740

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097740 2024-10-08T05:47:27 Z Yadav1992 Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define ll long long
#define mod 1000000007

vector<int> getInitialVector(int N) {
    vector<int> result(N, 0);
    for(int i = 1; i <= N; i++){
        result[i-1] = i;
    }
    return result;
}

int getPosition(int prev, int cur, int N) {
    return (cur - prev + N)/2;
}

void solve(int N)
{
    vector<int> R = getInitialVector(N);
    vector<int> A(N, -1);
    int prevCount = publish(R);
    for(int i = 1; i < N; i++) {
        int cur = R[N-1];
        R.pop_back();
        R.insert(R.begin(), cur);
        int curCount = publish(R);
        int position = getPosition(prevCount, curCount, N);
        A[position] = cur;
        prevCount = curCount;
    }
    for(int i = 0; i < N; i++) {
        if(A[i] == -1) {
            A[i] = 1;
            break;
        }
    }
    answer(A);
    
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:23:21: error: 'publish' was not declared in this scope
   23 |     int prevCount = publish(R);
      |                     ^~~~~~~
art.cpp:39:5: error: 'answer' was not declared in this scope
   39 |     answer(A);
      |     ^~~~~~
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) {
      |        ~~~~~~~~~^~~~