답안 #579594

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
579594 2022-06-19T12:43:34 Z Elias Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

#ifndef _DEBUG
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#endif

using namespace std;

#define lint int64_t

#ifdef _DEBUG

int publish(vector<int> R)
{
    for (int i : R)
        cout << i << " ";
    cout << "\n";

    int x;
    cin >> x;

    return x;
}

void answer(vector<int> R)
{
    cout << "Answer: ";
    for (int i : R)
        cout << i << " ";
    cout << "\n";
}

#endif

void solve(int N)
{
    int n = N;
    vector<int> position(n);

    vector<int> empty(n);
    for (int i = 0; i < n; i++)
        empty[i] = i + 1;

    map<vector<int>, int> answers;

    for (int i = 0; i < n; i++)
    {
        vector<int> queryA = empty;
        vector<int> queryB = empty;

        swap(queryA.back(), queryA[i]);
        swap(queryB[0], queryB[i]);

        int a, b;

        if (answers.count(queryA))
            a = answers[queryA];
        else
            a = answers[queryA] = publish(queryA);

        if (answers.count(queryB))
            b = answers[queryB];
        else
            b = answers[queryB] = publish(queryB);

        int diff = b - a;

        int pos = (n + diff - 1) / 2;

        position[i] = pos;
    }

    vector<int> sol(n);

    for (int i = 0; i < n; i++)
    {
        sol[position[i]] = i + 1;
    }

    answer(sol);
}

#ifdef _DEBUG

int main()
{
    int n;
    cin >> n;

    solve(n);
}

#endif

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:61:35: error: 'publish' was not declared in this scope
   61 |             a = answers[queryA] = publish(queryA);
      |                                   ^~~~~~~
art.cpp:66:35: error: 'publish' was not declared in this scope
   66 |             b = answers[queryB] = publish(queryB);
      |                                   ^~~~~~~
art.cpp:82:5: error: 'answer' was not declared in this scope; did you mean 'answers'?
   82 |     answer(sol);
      |     ^~~~~~
      |     answers
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) {
      |        ~~~~~~~~~^~~~