QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#250314#7687. Randias Permutation TaskXHYMathematicsCompile Error//C++141.9kb2023-11-13 03:26:382023-11-13 03:26:38

Judging History

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

  • [2023-11-13 03:26:38]
  • 评测
  • [2023-11-13 03:26:38]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr ll N=180;
basic_string<int>a[N],sk;
unordered_set<basic_string<int>>ans;
vector<int>c;
ll n,m;
bool f;
inline basic_string<int>solveans()
{
    ll k=c.size(),i,j;
    basic_string<int>ans=a[c[k-1]];
    for(i=k-2;i>=0;i--)
    {
        for(j=0;j<n;j++)ans[j]=a[c[i]][ans[j]-1];
    }
    return ans;
}
inline void dfs(ll x,ll cnt)
{
    if(cnt)ans.insert(solveans());
    if(cnt>=m)return;
    ll i;
    for(i=x;i<m;i++)
    {
        c.push_back(i);
        dfs(i+1,cnt+1);
        c.pop_back();
    }
}
inline basic_string<int>operator^(const basic_string<int> &a,const basic_string<int> &b)
{
    ll n=a.size(),i;
    basic_string<int>c;
    c.resize(n);
    for(i=0;i<n;i++)c[i]=a[b[i]-1];
    return c;
}
inline unordered_set<basic_string<int>>solve(ll l,ll r)
{
    if(r-l<=1)
    {
        if(a[l]!=sk)return {a[l]};
        else
        {
            f=1;
            return {};
        }
    }
    ll mid=(l+r)>>1;
    unordered_set<basic_string<int>>res,al,ar;
    basic_string<int>s;
    al=solve(l,mid),ar=solve(mid,r);
    for(auto&&i:al)res.insert(i);
    for(auto&&i:ar)res.insert(i);
    for(auto&&i:al)
    {
        for(auto&&j:ar)
        {
            s=i^j;
            if(s!=sk)res.insert(s);
            else f=1;
            s=j^i;
            if(s!=sk)res.insert(s);
            else f=1;
        }
    }
    return res;
}
int main()
{
    ll i,j;
    ios::sync_with_stdio(0),cin.tie(0);
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        a[i].resize(n);
        for(j=0;j<n;j++)cin>>a[i][j];
    }
    if(m<=20)
    {
        dfs(0,0);
        cout<<ans.size()<<'\n';
    }
    else
    {
        sk.resize(n);
        iota(sk.begin(),sk.end(),1);
        ll sum=solve(0,m).size();
        cout<<sum+f<<'\n';
    }
    return 0;
}

Details

answer.code:6:33: error: use of deleted function ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::__cxx11::basic_string<int>; _Hash = std::hash<std::__cxx11::basic_string<int> >; _Pred = std::equal_to<std::__cxx11::basic_string<int> >; _Alloc = std::allocator<std::__cxx11::basic_string<int> >]’
    6 | unordered_set<basic_string<int>>ans;
      |                                 ^~~
In file included from /usr/include/c++/11/unordered_set:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:118,
                 from answer.code:1:
/usr/include/c++/11/bits/unordered_set.h:135:7: note: ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::__cxx11::basic_string<int>; _Hash = std::hash<std::__cxx11::basic_string<int> >; _Pred = std::equal_to<std::__cxx11::basic_string<int> >; _Alloc = std::allocator<std::__cxx11::basic_string<int> >]’ is implicitly deleted because the default definition would be ill-formed:
  135 |       unordered_set() = default;
      |       ^~~~~~~~~~~~~
/usr/include/c++/11/bits/unordered_set.h:135:7: error: use of deleted function ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::__cxx11::basic_string<int>; _Value = std::__cxx11::basic_string<int>; _Alloc = std::allocator<std::__cxx11::basic_string<int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::__cxx11::basic_string<int> >; _Hash = std::hash<std::__cxx11::basic_string<int> >; _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>]’
In file included from /usr/include/c++/11/unordered_map:46,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:117,
                 from answer.code:1:
/usr/include/c++/11/bits/hashtable.h:512:7: note: ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::__cxx11::basic_string<int>; _Value = std::__cxx11::basic_string<int>; _Alloc = std::allocator<std::__cxx11::basic_string<int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::__cxx11::basic_string<int> >; _Hash = std::hash<std::__cxx11::basic_string<int> >; _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>]’ is implicitly deleted because the default definition would be ill-formed:
  512 |       _Hashtable() = default;
      |       ^~~~~~~~~~
/usr/include/c++/11/bits/hashtable.h:512:7: error: use of deleted function ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::__cxx11::basic_string<int>; _Value = std::__cxx11::basic_string<int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::__cxx11::basic_string<int> >; _Hash = std::hash<std::__cxx11::basic_string<int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’
In file included from /usr/include/c++/11/bits/hashtable.h:35,
                 from /usr/include/c++/11/unordered_map:46,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:117,
                 from answer.code:1:
/usr/include/c++/11/bits/hashtable_policy.h:1602:7: note: ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::__cxx11::basic_string<int>; _Value = std::__cxx11::basic_string<int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::__cxx11::basic_string<int> >; _Hash = std::hash<std::__cxx11::basic_string<int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’ is implicitly deleted because the default definition would be ill-formed:
 1602 |       _Hashtable_base() = default;
      |       ^~~~~~~~~~~~~~~
/usr/include/c++/11/bits/hashtable_policy.h:1602:7: error: use of deleted function ‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::__cxx11::basic_string<int>; _Value = std::__cxx11::basic_string<int>; _ExtractKey = std::__detail::_Identity; _Hash = std::hash<std::__cxx11::basic_string<int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]’
/usr/include/c++/11/bits/hashtable_policy.h:1209:7: note: ‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash,...