QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#418842#5119. Perfect WordreverSillyCompile Error//C++23730b2024-05-23 16:04:152024-05-23 16:04:15

Judging History

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

  • [2024-05-23 16:04:15]
  • 评测
  • [2024-05-23 16:04:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int mxn{100005};
int n;
unordered_set<string>S;
int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=0;i<n;++i)
    {
        string s;
        cin>>s;
        S.insert(s);
    }
    int ans=0;
    for(string const&s:S)
    {
        // if(s.length()<=sqrt(n)+1)
        {
            for(int i=0;i<s.length();++i)
            {
                for(int j=0;i+j<=s.length();++j)
                {
                    if(!S.contains(string_view(&s[i],j)))
                        goto nx;
                }
            }
            ans=max(ans,s.length());
        }
        nx:;
    }
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:26:35: error: no matching function for call to ‘std::unordered_set<std::__cxx11::basic_string<char> >::contains(std::string_view)’
   26 |                     if(!S.contains(string_view(&s[i],j)))
      |                         ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/unordered_set:41,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:189,
                 from answer.code:1:
/usr/include/c++/13/bits/unordered_set.h:717:9: note: candidate: ‘template<class _Kt> decltype (((((const std::unordered_set<_Value, _Hash, _Pred, _Alloc>*)this)->std::unordered_set<_Value, _Hash, _Pred, _Alloc>::_M_h._M_find_tr(__k), void()), true)) std::unordered_set<_Value, _Hash, _Pred, _Alloc>::contains(const _Kt&) const [with _Value = std::__cxx11::basic_string<char>; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]’
  717 |         contains(const _Kt& __k) const
      |         ^~~~~~~~
/usr/include/c++/13/bits/unordered_set.h:717:9: note:   template argument deduction/substitution failed:
/usr/include/c++/13/bits/unordered_set.h: In substitution of ‘template<class _Kt> decltype (((((const std::unordered_set<std::__cxx11::basic_string<char> >*)this)->std::unordered_set<std::__cxx11::basic_string<char> >::_M_h.std::_Hashtable<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> >, std::__detail::_Identity, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::_M_find_tr(__k), void()), true)) std::unordered_set<std::__cxx11::basic_string<char> >::contains(const _Kt&) const [with _Kt = std::basic_string_view<char>]’:
answer.code:26:35:   required from here
/usr/include/c++/13/bits/unordered_set.h:718:36: error: no matching function for call to ‘std::_Hashtable<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> >, std::__detail::_Identity, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, true, true> >::_M_find_tr(const std::basic_string_view<char>&) const’
  718 |         -> decltype(_M_h._M_find_tr(__k), void(), true)
      |                     ~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/13/bits/unordered_map.h:33,
                 from /usr/include/c++/13/unordered_map:41,
                 from /usr/include/c++/13/functional:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/hashtable.h:762:9: note: candidate: ‘template<class _Kt, class, class> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::iterator std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_M_find_tr(const _Kt&) [with <template-parameter-2-2> = _Kt; _Key = std::__cxx11::basic_string<char>; _Value = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::__cxx11::basic_string<char> >; _Hash = std::hash<std::__cxx11::basic_string<char> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’
  762 |         _M_find_tr(const _Kt& __k);
      |         ^~~~~~~~~~
/usr/include/c++/13/bits/hashtable.h:762:9: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/13/string:49,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52:
/usr/include/c++/13/bits/stl_function.h: In substitution of ‘template<class _Func, class _SfinaeType> using std::__has_is_transparent_t = typename std::__has_is_transparent<_Func, _SfinaeType>::type [with _Func = std::hash<std::__cxx11::basic_string<char> >; _SfinaeType = std::basic_string_view<char>]’:
/usr/include/c++/13/bits/hashtable.h:759:9:   required by substitution of ‘template<class _Kt> decltype (((((const std::unordered_set<std::__cxx11::basic_string<char> >*)this)->std::unordered_set<std::__cxx11::basic_string<char> >::_M_h.std::_Hashtable<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char> >, std::__detail::_Identity, std::equal_to<std::__cxx11::basic_string<char> ...