Submission #1212820

#TimeUsernameProblemLanguageResultExecution timeMemory
1212820lance0The Collection Game (BOI21_swaps)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void solve(int N, int V) { vector<int> ans; for (int i = 1; i <= N; i++) { ans.push_back(i); } for (int i = 0; i < 500; i++) { int j; if (i % 2) { j = 2; } else { j = 1; } for (int k = j; k < N-1; k+=2) { schedule(ans[k-1], ans[k]); } vector<int> res = visit(); for (int k = 0; k < res.size(); k++) {\ //the corresponding indices are j-1+2*k, j+2*k if (res[k] == 0) { swap(ans[j-1+2*k],ans[j+2*k]); } } } answer(ans); }

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:17:25: error: 'schedule' was not declared in this scope
   17 |                         schedule(ans[k-1], ans[k]);
      |                         ^~~~~~~~
swaps.cpp:19:40: error: no matching function for call to 'visit()'
   19 |                 vector<int> res = visit();
      |                                   ~~~~~^~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from swaps.cpp:1:
/usr/include/c++/11/variant:1734:5: note: candidate: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1734 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
/usr/include/c++/11/variant:1734:5: note:   template argument deduction/substitution failed:
swaps.cpp:19:40: note:   candidate expects at least 1 argument, 0 provided
   19 |                 vector<int> res = visit();
      |                                   ~~~~~^~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133,
                 from swaps.cpp:1:
/usr/include/c++/11/variant:1774:5: note: candidate: 'template<class _Res, class _Visitor, class ... _Variants> constexpr _Res std::visit(_Visitor&&, _Variants&& ...)'
 1774 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
/usr/include/c++/11/variant:1774:5: note:   template argument deduction/substitution failed:
swaps.cpp:19:40: note:   candidate expects at least 1 argument, 0 provided
   19 |                 vector<int> res = visit();
      |                                   ~~~~~^~
swaps.cpp:27:9: error: 'answer' was not declared in this scope
   27 |         answer(ans);
      |         ^~~~~~