답안 #827346

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

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

void answer(vi R)
{
    //for(int& i : R)cout << i << ' ';cout << endl;
}

void solve(int N)
{
    vi ans(N);
    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;
            swap(ans[i], ans[j]);
            int new_w = publish(ans);
            if(new_w == 0)
            {
                answer(ans);
                return; // maybe comment out? idk
            }
            if(new_w < w)
            {
                w = new_w;
                i = j;
            }
            else swap(ans[i], ans[j]);
        }
        i = icpy;
    }

}


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

Compilation message

art.cpp: In function 'int publish(vi)':
art.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
   16 | }
      | ^
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) {
      |        ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccI4XwhA.o: in function `publish(std::vector<int, std::allocator<int> >)':
interface.cpp:(.text+0x60): multiple definition of `publish(std::vector<int, std::allocator<int> >)'; /tmp/ccEscM6y.o:art.cpp:(.text.unlikely+0x0): first defined here
/usr/bin/ld: /tmp/ccI4XwhA.o: in function `answer(std::vector<int, std::allocator<int> >)':
interface.cpp:(.text+0x170): multiple definition of `answer(std::vector<int, std::allocator<int> >)'; /tmp/ccEscM6y.o:art.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status