답안 #783072

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783072 2023-07-14T14:58:43 Z JooDdae Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include "dango3.h"

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

vector<int> done;

int query(vector<int> q) {
    for(auto x : done) q.push_back(x);
    return Query(q);
}

void Solve(int N, int M) {
    vector<int> v(N*M);
    iota(v.begin(), v.end(), 1);

    random_device rd;
    shuffle(v.begin(), v.end(), mt19937(rd()));

    vector<vector<int>> type(N, vector<int>());

    for(int i=0;i<N-1;i++) {
        int l = 1, r = (int)v.size()-1;
        while(l <= r) {
            int mid = (l+r) >> 1;

            auto re = query(done, vector<int>(v.begin(), v.begin()+mid+1));
            if(re) r = mid-1;
            else l = mid+1;
        }

        vector<int> x = vector<int>(v.begin(), v.begin()+l);

        for(int u=l;u<v.size();u++) {
            x.push_back(v[u]);
            if(query(x)) {
                done.push_back(x), type[i].push_back(v[u]);
                v.erase(v.begin()+u), u--;
            }
            x.pop_back();
        }
    }

    type[N-1] = v;

    for(int i=0;i<M;i++) {
        vector<int> re;
        for(int j=0;j<N;j++) re.push_back(type[j][i]);
        Answer(re);
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:28:74: error: too many arguments to function 'int query(std::vector<int>)'
   28 |             auto re = query(done, vector<int>(v.begin(), v.begin()+mid+1));
      |                                                                          ^
dango3.cpp:9:5: note: declared here
    9 | int query(vector<int> q) {
      |     ^~~~~
dango3.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(int u=l;u<v.size();u++) {
      |                     ~^~~~~~~~~
dango3.cpp:38:33: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   38 |                 done.push_back(x), type[i].push_back(v[u]);
      |                                 ^
In file included from /usr/include/c++/10/vector:67,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~