提交时间:2024-09-08 15:51:45

运行 ID: 32344

#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define i128 __int128_t const int lim=90; inline i128 trs(i128 S,int c){ i128 T=0; for(int i=0;i<c;i++) if((S>>i)&1) T|=((i128(1))<<(c-i)); T|=S>>c; T|=S<<c; return T&(((i128(1))<<lim+1)-1); } map<i128,int>id; int ct=0; inline void dfs(int dep,int rem,i128 S){ if(dep==10){ if(!id.count(S))id[S]=++ct; return ; } for(int i=0;i<=rem;i++) dfs(dep+1,rem-i,S),S=trs(S,dep); } signed main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); // freopen("true.in","r",stdin); // freopen("true.out","w",stdout); // int C=clock(); dfs(1,18,1); // cout<<(clock()-C)* 1000/CLOCKS_PER_SEC<<endl; cout<<ct<<endl; cout.flush(); fflush(stdout); return 0; }