// g++-15 1.cpp -std=c++23 -O2 -I . // 壊れるとき // conda deactivate # 何回か必要なことあり // hash -r # コマンドキャッシュクリア // which -a ld // ld の先頭が /usr/bin/ld になればそのままコンパイルしてOK #include using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") // #include // #include // #include // using namespace __gnu_pbds; #include #include #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) template istream& operator>>(istream& is, pair &v){ is >> v.first >> v.second; return is; } template ostream& operator<<(ostream& os, pair &v){ os << v.first << " " << v.second << "\n"; return os; } template istream& operator>>(istream& is, vector &v){ for(T &e: v) is >> e; return is; } template ostream& operator<<(ostream& os, vector v){ if(v.empty()){ os<<"\n"; return os; } for(int i=0;i>n>>m>>d; int rem=n*(n-1)/2-m; // rem 残す dp[0][1][1][0]=1; vector>> sub; rep(k,1,n+1){ // 直前に k 個ある vector init(k); rep(l,0,k)init[l]=COM(k,(l+1)); // init[l] := 1 つの距離 i + 1 の頂点から距離 i へ伸ばす // l + 1 個繋げる場合の数え上げ vector state={1}; vector> dp2={state}; rep(nxtk,1,n-k+1){ // ここでは nxtk 個使う state=convolution(state,init); vector dp3; int edge=nxtk*(nxtk-1)/2; rep(add,0,edge+1){ dp3.emplace_back(COM(edge,add)); } dp2.emplace_back(convolution(state,dp3)); } sub.emplace_back(dp2); } rep(i,0,n-1){ // dp[i] -> dp[i+1] rep(j,0,n+1){ rep(k,1,j+1){ rep(l,j-1,j*(j-1)/2+1){ if(dp[i][j][k][l].val()==0)continue; // cout<>t; while(t--){ solve(); } }