QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#621214#7686. The Phantom Menacerotcar07Compile Error//C++202.3kb2024-10-08 11:09:552024-10-08 11:09:55

Judging History

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

  • [2024-10-08 14:11:03]
  • hack成功,自动添加数据
  • (/hack/941)
  • [2024-10-08 11:09:55]
  • 评测
  • [2024-10-08 11:09:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int maxn=2e6+5;
int n,m;
vector<pair<int,int>> e[maxn];
typedef __int128 ull;
mt19937 rnd(time(0));
const ull base=rnd()%100+233,mod=1000000007998244353;
ull bs[maxn];
vector<ull> hs[maxn][2];
vector<int> ans;
void dfs(int p){
    while(!e[p].empty()){
        auto x=e[p].back();e[p].pop_back();
        dfs(x.first);
        ans.push_back(x.second);
    }
}
int deg[maxn];
inline void solve(){
    cin>>n>>m;for(int _:{0,1}){
        for(int i=1;i<=n;i++){
            string s;cin>>s;
            ull cur=0;hs[i][_].clear();hs[i][_].push_back(cur);
            for(auto x:s) hs[i][_].push_back(cur=(cur*base+x)%mod);
        }
    }
    for(int t=0;t<m;t++){
        ans.clear();
        // cout<<"1233 "<<t<<'\n';
        unordered_map<ull,int> p[2];
        int tot=0;
        auto get=[&](int op,ull x){
            // cout<<op<<' '<<x<<'\n';
            if(p[op].count(x)) return p[op][x];
            else return p[op][x]=++tot;
        };
        for(int i=1;i<=n;i++){
            ull x=hs[i][0][t],y=(hs[i][0][m]+mod-hs[i][0][t]*bs[m-t]%mod)%mod;
            int xx=get(0,x),yy=get(1,y);
            // cout<<i<<' '<<xx<<' '<<yy<<'\n';
            e[xx].push_back(make_pair(yy,i));deg[yy]++;
        }
        for(int i=1;i<=n;i++){
            ull x=hs[i][1][m-t],y=(hs[i][1][m]+mod-hs[i][1][m-t]*bs[t]%mod)%mod;
            int xx=get(1,x),yy=get(0,y);
            e[xx].push_back(make_pair(yy,-i));deg[yy]++;
        }
        bool f=1;
        for(int i=1;i<=tot;i++) {if(e[i].size()!=deg[i]) f=0;deg[i]=0;}
        dfs(1);
        // for(auto x:ans) cout<<x<<' ';cout<<'\n';
        for(int i=1;i<=tot;i++)e[i].clear();
        if(!f) continue;
        if(ans.size()==2*n){
            reverse(ans.begin(),ans.end());
            vector<int> u,v;
            for(auto x:ans) (x>0?u:v).push_back(abs(x));
            assert(u.size()==v.size());
            for(auto x:u) cout<<x<<' ';cout<<'\n';
            for(auto y:v) cout<<y<<' ';cout<<'\n';
            return;
        }
    }
    cout<<"-1\n";
}
int main(){
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int T;cin>>T;
    for(int i=bs[0]=1;i<=maxn-5;i++) bs[i]=bs[i-1]*base%mod;
    while(T--) solve();
}

详细

answer.code: In function ‘void solve()’:
answer.code:31:35: error: use of deleted function ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = __int128; _Tp = int; _Hash = std::hash<__int128>; _Pred = std::equal_to<__int128>; _Alloc = std::allocator<std::pair<const __int128, int> >]’
   31 |         unordered_map<ull,int> p[2];
      |                                   ^
In file included 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,
                 from answer.code:1:
/usr/include/c++/13/bits/unordered_map.h:148:7: note: ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = __int128; _Tp = int; _Hash = std::hash<__int128>; _Pred = std::equal_to<__int128>; _Alloc = std::allocator<std::pair<const __int128, int> >]’ is implicitly deleted because the default definition would be ill-formed:
  148 |       unordered_map() = default;
      |       ^~~~~~~~~~~~~
/usr/include/c++/13/bits/unordered_map.h:148:7: error: use of deleted function ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = __int128; _Value = std::pair<const __int128, int>; _Alloc = std::allocator<std::pair<const __int128, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
In file included from /usr/include/c++/13/bits/unordered_map.h:33:
/usr/include/c++/13/bits/hashtable.h:530:7: note: ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = __int128; _Value = std::pair<const __int128, int>; _Alloc = std::allocator<std::pair<const __int128, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’ is implicitly deleted because the default definition would be ill-formed:
  530 |       _Hashtable() = default;
      |       ^~~~~~~~~~
/usr/include/c++/13/bits/hashtable.h:530:7: error: use of deleted function ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = __int128; _Value = std::pair<const __int128, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
In file included from /usr/include/c++/13/bits/hashtable.h:35:
/usr/include/c++/13/bits/hashtable_policy.h:1710:7: note: ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = __int128; _Value = std::pair<const __int128, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’ is implicitly deleted because the default definition would be ill-formed:
 1710 |       _Hashtable_base() = default;
      |       ^~~~~~~~~~~~~~~
/usr/include/c++/13/bits/hashtable_policy.h:1710: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 = __int128; _Value = std::pair<const __int128, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]’
/usr/include/c++/13/bits/hashtable_policy.h: In instantiation of ‘std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<__int128>]’:
/usr/include/c++/13/bits/hashtable_policy.h:1297:7:   required from here
/usr/include/c++/13/bits/hashtable_policy.h:1214:49: error: use of deleted function ‘std::hash<__int128>::hash()’
 1214 |       _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
      |                                                 ^~~~~
In file included from /usr/include/c++/13/string_view:42,
                 from /usr/include/c++/13/bits/basic_string.h:47,
                 from /usr/include/c++/13/string:54,
                 from /usr/include/c++/13/bitset:52,
                 from ...