답안 #827355

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827355 2023-08-16T11:46:40 Z vjudge1 Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
//#include"art.h" // Don't forget to uncomment!
typedef std::vector<int> vi;

/*
int publish(std::vector<int> R)
{
    for(int& i : R)cout << i << ' ';cout << endl;// COMMENT OUT
    int w;
    cin >> w;
    return w;
}
*/

/*
void answer(std::vector<int> R)
{
    for(int& i : R)cout << i << ' ';cout << endl;
}
*/

void solve(int N)
{
    std::vector<int> ans(N);
    std::iota(ans.begin(), ans.end(), 1ll);
    int w = publish(ans);
    for(int i = 0; i < N; i++)
    {
        int icpy = i;
        for(int j = 0; j < N; ++j)
        {
            if(j == i)continue;
            std::swap(ans[i], ans[j]);
            int new_w = publish(ans);
            if(new_w == 0)
            {
                std::answer(ans);
                //return; // maybe comment out? idk
            }
            if(new_w < w)
            {
                w = new_w;
                i = j;
            }
            else std::wap(ans[i], ans[j]);
        }
        i = icpy;
    }

}


/*
int main()
{
    solve(4);
}
*/

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:29:13: error: 'publish' was not declared in this scope
   29 |     int w = publish(ans);
      |             ^~~~~~~
art.cpp:40:22: error: 'answer' is not a member of 'std'
   40 |                 std::answer(ans);
      |                      ^~~~~~
art.cpp:48:23: error: 'wap' is not a member of 'std'; did you mean 'swap'?
   48 |             else std::wap(ans[i], ans[j]);
      |                       ^~~
      |                       swap
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) {
      |        ~~~~~~~~~^~~~