QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#446284#8527. Power Divisionsucup-team3215Compile Error//C++201.8kb2024-06-17 06:04:192024-06-17 06:04:19

Judging History

你现在查看的是最新测评结果

  • [2024-06-17 06:04:19]
  • 评测
  • [2024-06-17 06:04:19]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

constexpr auto exps = array{61, 59, 53, 47};
using E = decay_t<decltype(exps)>;
constexpr int N = 3e5 + 1;
constexpr uint64_t mod = -49ull / 2;

unordered_map<uint64_t, unordered_map<uint64_t, unordered_map<uint64_t, unordered_map<uint64_t, unordered_map<uint64_t, unordered_map<uint64_t, vector<int>>>>>>> m;

vector<int> ls[N];

template <int i = 0>
auto& mget(const E& e, auto& m) {
  if constexpr (i == exps.size()) return m;
  else return mget<i + 1>(e, m[e[i]]);
}

template <int i = 0>
void walk(const E& e, auto& m, uint64_t k, uint64_t pr, auto f) {
  if constexpr (i == exps.size()) f(m, k);
  else {
    uint64_t step = pr;
    while (step % exps[i] != 1) step += pr;
    while (k % exps[i]) k += pr;
    pr *= exps[i];
    for (int j = 0; j < exps[i]; ++j) {
      auto it = m.find((e[i] + (1ull << exps[i]) - 1 - (1ull << j)) % ((1ull << exps[i]) - 1));
      if (it != m.end()) walk<i + 1>(e, it->second, k, pr, f);
      k = (k + step) % pr;
    }
  }
}

int dp[N];

uint64_t pw[(int)1e6 + 1];
uint64_t pss[N];

int main() {
  cin.tie(0)->sync_with_stdio(0);
  pw[0] = 1;
  for (uint64_t i = 1, p = 2; i < size(pw); ++i) pw[i] = p, p = (p + p) % mod;
  int n; cin >> n;
  E ps{};
  uint64_t psm{};
  for (int i = 0; ; ++i) {
    mget(ps, m).push_back(i);
    walk(ps, m, 0, 1, [&](auto& v, auto k) { if (k <= 1e6) for (auto& j: v) if (pss[j] == (psm + mod - pw[k]) % mod) ls[i].push_back(j); });
    pss[i] = psm;
    if (i == n) break;
    int v; cin >> v;
    for (int j = 0; j < exps.size(); ++j) ps[j] = (ps[j] + (1ull << v % exps[j])) % ((1ull << exps[j]) - 1);
    psm = (psm + pw[v]) % mod;
  }
  dp[0] = 1;
  for (int i = 1; i <= n; ++i)
  for (auto j: ls[i]) dp[i] = (dp[i] + dp[j]) % ((int)1e9 + 7);
  cout << dp[n];
}

Details

answer.code: In function ‘int main()’:
answer.code:49:17: error: ‘class std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > >’ has no member named ‘push_back’
   49 |     mget(ps, m).push_back(i);
      |                 ^~~~~~~~~
answer.code: In instantiation of ‘main()::<lambda(auto:57&, auto:58)> [with auto:57 = std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > >; auto:58 = long unsigned int]’:
answer.code:30:37:   recursively required from ‘void walk(const E&, auto:55&, uint64_t, uint64_t, auto:56) [with int i = 1; auto:55 = std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > > > > >; auto:56 = main()::<lambda(auto:57&, auto:58)>; E = std::array<int, 4>; uint64_t = long unsigned int]’
answer.code:30:37:   required from ‘void walk(const E&, auto:55&, uint64_t, uint64_t, auto:56) [with int i = 0; auto:55 = std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > > > > > >; auto:56 = main()::<lambda(auto:57&, auto:58)>; E = std::array<int, 4>; uint64_t = long unsigned int]’
answer.code:50:9:   required from here
answer.code:50:84: error: no match for ‘operator[]’ (operand types are ‘uint64_t [300001]’ {aka ‘long unsigned int [300001]’} and ‘std::pair<const long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > >’)
   50 |     walk(ps, m, 0, 1, [&](auto& v, auto k) { if (k <= 1e6) for (auto& j: v) if (pss[j] == (psm + mod - pw[k]) % mod) ls[i].push_back(j); });
      |                                                                                 ~~~^
answer.code:50:133: error: no matching function for call to ‘std::vector<int>::push_back(std::pair<const long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > >&)’
   50 |     walk(ps, m, 0, 1, [&](auto& v, auto k) { if (k <= 1e6) for (auto& j: v) if (pss[j] == (psm + mod - pw[k]) % mod) ls[i].push_back(j); });
      |                                                                                                                      ~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_vector.h:1278:7: note: candidate: ‘constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]’
 1278 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1278:35: note:   no known conversion for argument 1 from ‘std::pair<const long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > >’ to ‘const std::vector<int>::value_type&’ {aka ‘const int&’}
 1278 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:1295:7: note: candidate: ‘constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]’
 1295 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1295:30: note:   no known conversion for argument 1 from ‘std::pair<const long unsigned int, std::unordered_map<long unsigned int, std::vector<int> > >’ to ‘std::vector<int>::value_type&&’ {aka ‘int&&’}
 1295 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~