답안 #988538

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988538 2024-05-25T06:26:06 Z toan2602 Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "dango3.h"

using namespace std;

vector<int> ans, v2, x;

void Solve(int n, int m) {
    for (int i = n; i >= 1; i--) x.push_back(i);
    v2 = x;
    while(!x.empty()) {
        int cur = x.back();
        x.pop_back();
        v2 = x;
        for (int i: ans) v2.push_back(i);
        if(Query(v2) == 0) {
            ans.push_back(x);
        }
    }
    Answer(ans);
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:17:28: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   17 |             ans.push_back(x);
      |                            ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 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)
      |                 ~~~~~~~~~~~~~^~~
dango3.cpp:12:13: warning: unused variable 'cur' [-Wunused-variable]
   12 |         int cur = x.back();
      |             ^~~