QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#654999#9225. Fibonacci Fusionreal_sigma_team#Compile Error//C++171.8kb2024-10-18 23:40:142024-10-18 23:40:15

Judging History

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

  • [2024-10-18 23:40:15]
  • 评测
  • [2024-10-18 23:40:14]
  • 提交

answer

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

uint64_t mod = 1836311903ull * 1134903170;
uint64_t mod2 = 1836311903ull * 1134903170;

const int K = 2200;

uint64_t add(uint64_t a, uint64_t b) {
    return a + b >= mod ? a + b - mod : a + b;
}
uint64_t sub(uint64_t a, uint64_t b) {
    return a >= b ? a - b : a + mod - b;
}
uint64_t mul(uint64_t a, uint64_t b) {
    return 1ll * a * b % mod;
}

std::vector<uint64_t> st, hsh;

int main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);

    {
        uint64_t a = 0, b = 1;
        st = {a, b};
        for (int i = 0; i < 1e6; ++i) {
            uint64_t c = add(a, b);
            st.push_back(c);
            a = b;
            b = c;
        }
        std::sort(st.begin(), st.end());
        st.resize(std::unique(st.begin(), st.end()) - st.begin());
    }

//    {
//        mod = (1ll << 61) - 1;
//        uint64_t a = 0, b = 1;
//        hsh = {a, b};
//        for (int i = 0; i < 1e7; ++i) {
//            uint64_t c = add(a, b);
//            hsh.push_back(c);
//            a = b;
//            b = c;
//        }
//        std::sort(hsh.begin(), hsh.end());
//    }

    int n;
    std::cin >> n;
    gp_hash_table<uint64_t, int> mp;
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        std::string s;
        std::cin >> s;
        uint64_t h = 0;
        for (auto x : s) {
            uint64_t h2 = add(h, h);
            uint64_t h4 = add(h2, h2);
            uint64_t h8 = add(h4, h4);
            h = add(add(h8, h2), x - '0');
        }
        for (auto x : st) {
            uint64_t need = sub(x, h);
            if (mp.find(need)) ans += mp[need];
        }
        mp[h]++;
    }
    std::cout << ans;
}

Details

answer.code: In function ‘int main()’:
answer.code:67:24: error: could not convert ‘__gnu_pbds::detail::gp_ht_map<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>::find(key_const_reference) [with Key = long unsigned int; Mapped = int; Hash_Fn = std::tr1::hash<long unsigned int>; Eq_Fn = std::equal_to<long unsigned int>; _Alloc = std::allocator<char>; bool Store_Hash = false; Comb_Probe_Fn = __gnu_pbds::direct_mask_range_hashing<>; Probe_Fn = __gnu_pbds::linear_probe_fn<long unsigned int>; Resize_Policy = __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>; point_iterator = __gnu_pbds::detail::gp_ht_map<long unsigned int, int, std::tr1::hash<long unsigned int>, std::equal_to<long unsigned int>, std::allocator<char>, false, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::linear_probe_fn<long unsigned int>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int> >::point_iterator_; key_const_reference = const long unsigned int&](need)’ from ‘__gnu_pbds::detail::gp_ht_map<long unsigned int, int, std::tr1::hash<long unsigned int>, std::equal_to<long unsigned int>, std::allocator<char>, false, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::linear_probe_fn<long unsigned int>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int> >::point_iterator’ {aka ‘__gnu_pbds::detail::gp_ht_map<long unsigned int, int, std::tr1::hash<long unsigned int>, std::equal_to<long unsigned int>, std::allocator<char>, false, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::linear_probe_fn<long unsigned int>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int> >::point_iterator_’} to ‘bool’
   67 |             if (mp.find(need)) ans += mp[need];
      |                 ~~~~~~~^~~~~~
      |                        |
      |                        __gnu_pbds::detail::gp_ht_map<long unsigned int, int, std::tr1::hash<long unsigned int>, std::equal_to<long unsigned int>, std::allocator<char>, false, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::linear_probe_fn<long unsigned int>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int> >::point_iterator {aka __gnu_pbds::detail::gp_ht_map<long unsigned int, int, std::tr1::hash<long unsigned int>, std::equal_to<long unsigned int>, std::allocator<char>, false, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::linear_probe_fn<long unsigned int>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int> >::point_iterator_}