Submission #1206126

#TimeUsernameProblemLanguageResultExecution timeMemory
1206126jer033The Collection Game (BOI21_swaps)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; vector<vector<pii>> comparisons; void call_in(int i, int j, int round) { comparisons[round].push_back({i, j}); } void group_call_in(int i, int j, int round) { int mid = (i+j)/2; int diff = mid-i+1; for (int k=i; k<=mid; k++) call_in(k, k+diff, round); if ((j-i)>1) { group_call_in(i, mid, round+1); group_call_in(mid+1, j, round+1); } } void sortpow2(int lo, int hi, int major_round) { int mid = (lo+hi)/2; if ((hi-lo)>1) { sortpow2(lo, mid, major_round-1); sortpow2(mid+1, hi, major_round-1); } int first_round_in_major_round = ((major_round)*(major_round-1))/2 - 1; for (int i=lo; i<=mid; i++) call_in(i, lo+hi-i, first_round_in_major_round); group_call_in(lo, mid, first_round_in_major_round+1); group_call_in(mid+1, hi, first_round_in_major_round+1); } void init() { int K = 512; comparisons = vector<vector<pii>> (45); sortpow2(1, 512, 9); } void solve(int N, int V) { init(); for (int i=0; i<45; i++) { for (pii x: comparisons[i]) { int x1 = x.first; int x2 = x.second; if ((x1<=N) and (x2<=N)) schedule(x.first, x.second); } visit(); } vector<int> beauty; for (int i=1; i<=N; i++) beauty.push_back(i); answer(beauty); }

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:57:17: error: 'schedule' was not declared in this scope
   57 |                 schedule(x.first, x.second);
      |                 ^~~~~~~~
swaps.cpp:59:14: error: no matching function for call to 'visit()'
   59 |         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:59:14: note:   candidate expects at least 1 argument, 0 provided
   59 |         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:59:14: note:   candidate expects at least 1 argument, 0 provided
   59 |         visit();
      |         ~~~~~^~
swaps.cpp:64:5: error: 'answer' was not declared in this scope
   64 |     answer(beauty);
      |     ^~~~~~