Submission #1350257

#TimeUsernameProblemLanguageResultExecution timeMemory
1350257dodjingArt Collections (BOI22_art)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <cstdint>
#include <chrono>
#include "art.h"

#define ll long long

using namespace std;

void solve(int n) {
    vector <int> aaa(n);
    for (int i = 0; i < n; i++) {
        aaa[i] = i + 1;
    }
    vector <int> res;
    int latest = -1;
    for (int i = 0; i < n; i++) {
        res = publish(aaa);
        for (int j = 0; j < n; j++) {
            if (res[j] == j - i) latest = j;
        }
        swap(aaa[i], aaa[latest]);
    }
    answer(aaa);
}

int main() {
    return 0;
}

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:21:26: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
   21 |         res = publish(aaa);
      |                          ^
In file included from /usr/include/c++/13/vector:72,
                 from art.cpp:2:
/usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~