結果
問題 | No.1937 Various Tournament |
ユーザー | 沙耶花 |
提出日時 | 2022-05-13 22:22:13 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,533 bytes |
コンパイル時間 | 4,471 ms |
コンパイル使用メモリ | 265,748 KB |
実行使用メモリ | 8,820 KB |
最終ジャッジ日時 | 2023-09-29 07:48:24 |
合計ジャッジ時間 | 10,483 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | TLE | - |
testcase_02 | TLE | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int n; vector<string> s; int main(){ cin>>n; s.resize(n,""); rep(i,n){ rep(j,n){ int t; cin>>t; s[i] += '0'+t; } } vector<long long> ans(n,0); rep(i,n){ vector<long long> dp(1<<n,0); dp[1<<i] = 1; long long c = 1LL; while(c!=n){ rep(j,dp.size()){ if(__builtin_popcount(j)!=c)continue; vector<int> x,y; rep(k,n){ if((j>>k)&1)x.push_back(k); else y.push_back(k); } vector<long long> ddp(1<<y.size(),0); ddp[0] = 1; rep(k,x.size()){ vector<long long> ndp(1<<y.size(),0); rep(l,ddp.size()){ if(ddp[l]==0)continue; //cout<<k<<','<<x[k]<<','<<l<<','<<ddp[l]<<endl; rep(ll,y.size()){ if((l>>ll)&1)continue; if(s[x[k]][y[ll]]=='0')continue; //cout<<(l|(1<<ll))<<','<<ddp[l]<<endl; ndp[l | (1<<ll)] += ddp[l]; } } swap(ddp,ndp); } rep(k,ddp.size()){ if(ddp[k]==0)continue; int T =0; rep(l,y.size()){ if((k>>l)&1)T |= 1<<y[l]; } //cout<<j<<','<<T<<endl; dp[T|j] += dp[j] * ddp[k]; } //dp[j] = 0; } c*=2; /* rep(j,dp.size()){ cout<<dp[j]<<','; } cout<<endl; */ } ans[i] += dp.back(); //ans[i] += dp.back(); } rep(i,n)ans[i] *= 1LL<<(n-1); rep(i,n){ cout<<ans[i]<<endl; } return 0; }