Submission #1212757

#TimeUsernameProblemLanguageResultExecution timeMemory
1212757lrnnzThe Collection Game (BOI21_swaps)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <iomanip> using namespace std; #define all(a) (a).begin(), (a).end() #define sz(a) (int)(a).size() #define ll long long #define ld long double #define ui uint64_t #define cont(set, element) ((set).find(element) != (set).end()) /********* DEBUG *********/ template <typename T> void outvec(const vector<T>& Z){ for (const T& x : Z) cout << x << ' '; cout << "\n"; } void printVariable(const any& var) { if (!var.has_value()) { cout << "null"; return; } if (var.type() == typeid(int)) { cout << any_cast<int>(var); } else if (var.type() == typeid(double)) { cout << any_cast<double>(var); } else if (var.type() == typeid(float)) { cout << any_cast<float>(var); } else if (var.type() == typeid(char)) { cout << any_cast<char>(var); } else if (var.type() == typeid(bool)) { cout << (any_cast<bool>(var) ? "true" : "false"); } else if (var.type() == typeid(string)) { cout << any_cast<string>(var); } else if (var.type() == typeid(const char*)) { cout << any_cast<const char*>(var); } else if (var.type() == typeid(long long)) { cout << any_cast<long long>(var); } else { cout << "[unknown type]"; } } template<typename... Args> void outval(Args... args) { vector<any> variables = {args...}; for (size_t i = 0; i < variables.size(); ++i) { printVariable(variables[i]); if (i != variables.size() - 1) { cout << " "; } } cout << "\n"; } #define sp << " " << /********* DEBUG *********/ const ll MOD = 1000000007; const ll MOD2 = 998244353; const ll inf = 1e18; const ll mxN = 1000005; void solve(int n, int q){ vector<int> ans(n, 1); for (int i = 1; i <= n; i++){ ll zer = 1; for (int j = 1; j <= n; j++){ if (j == i) continue; schedule(i,j); zer += visit()[0]^1; } ans.push_back(zer); } answer(ans); }

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:82:13: error: 'schedule' was not declared in this scope
   82 |             schedule(i,j);
      |             ^~~~~~~~
swaps.cpp:83:25: error: no matching function for call to 'visit()'
   83 |             zer += visit()[0]^1;
      |                    ~~~~~^~
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:83:25: note:   candidate expects at least 1 argument, 0 provided
   83 |             zer += visit()[0]^1;
      |                    ~~~~~^~
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:83:25: note:   candidate expects at least 1 argument, 0 provided
   83 |             zer += visit()[0]^1;
      |                    ~~~~~^~
swaps.cpp:89:5: error: 'answer' was not declared in this scope
   89 |     answer(ans);
      |     ^~~~~~