結果
問題 | No.1937 Various Tournament |
ユーザー |
![]() |
提出日時 | 2022-05-13 22:06:25 |
言語 | C++17 (gcc 11.2.0 + boost 1.78.0) |
結果 |
AC
|
実行時間 | 341 ms / 2,000 ms |
コード長 | 1,606 bytes |
コンパイル時間 | 1,836 ms |
使用メモリ | 11,484 KB |
最終ジャッジ日時 | 2023-02-21 14:40:32 |
合計ジャッジ時間 | 14,252 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,208 KB |
testcase_01 | AC | 326 ms
11,328 KB |
testcase_02 | AC | 337 ms
11,328 KB |
testcase_03 | AC | 335 ms
11,396 KB |
testcase_04 | AC | 335 ms
11,356 KB |
testcase_05 | AC | 2 ms
6,252 KB |
testcase_06 | AC | 339 ms
11,320 KB |
testcase_07 | AC | 338 ms
11,472 KB |
testcase_08 | AC | 1 ms
6,268 KB |
testcase_09 | AC | 341 ms
11,392 KB |
testcase_10 | AC | 2 ms
6,268 KB |
testcase_11 | AC | 336 ms
11,472 KB |
testcase_12 | AC | 337 ms
11,392 KB |
testcase_13 | AC | 338 ms
11,328 KB |
testcase_14 | AC | 336 ms
11,376 KB |
testcase_15 | AC | 339 ms
11,388 KB |
testcase_16 | AC | 336 ms
11,448 KB |
testcase_17 | AC | 337 ms
11,324 KB |
testcase_18 | AC | 340 ms
11,388 KB |
testcase_19 | AC | 337 ms
11,448 KB |
testcase_20 | AC | 2 ms
6,272 KB |
testcase_21 | AC | 2 ms
6,316 KB |
testcase_22 | AC | 338 ms
11,448 KB |
testcase_23 | AC | 335 ms
11,380 KB |
testcase_24 | AC | 337 ms
11,332 KB |
testcase_25 | AC | 2 ms
6,252 KB |
testcase_26 | AC | 337 ms
11,448 KB |
testcase_27 | AC | 2 ms
6,168 KB |
testcase_28 | AC | 334 ms
11,476 KB |
testcase_29 | AC | 1 ms
6,280 KB |
testcase_30 | AC | 335 ms
11,396 KB |
testcase_31 | AC | 336 ms
11,324 KB |
testcase_32 | AC | 339 ms
11,384 KB |
testcase_33 | AC | 337 ms
11,376 KB |
testcase_34 | AC | 338 ms
11,428 KB |
testcase_35 | AC | 337 ms
11,484 KB |
testcase_36 | AC | 337 ms
11,336 KB |
testcase_37 | AC | 1 ms
7,592 KB |
testcase_38 | AC | 2 ms
9,756 KB |
testcase_39 | AC | 338 ms
11,468 KB |
testcase_40 | AC | 2 ms
7,564 KB |
testcase_41 | AC | 2 ms
7,568 KB |
testcase_42 | AC | 339 ms
11,392 KB |
testcase_43 | AC | 2 ms
10,244 KB |
testcase_44 | AC | 2 ms
7,600 KB |
testcase_45 | AC | 339 ms
11,328 KB |
testcase_46 | AC | 1 ms
7,672 KB |
testcase_47 | AC | 1 ms
7,680 KB |
testcase_48 | AC | 1 ms
7,668 KB |
testcase_49 | AC | 2 ms
7,576 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; } #define all(x) (x).begin(),(x).end() #define fi first #define se second #define mp make_pair #define si(x) int(x.size()) const int mod=998244353,MAX=300005; const ll INF=1LL<<60; int S[16][16]; ll dp[1<<16][16]; bool seen[1<<16][16]; int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); int N;cin>>N; //vector<vector<int>> S(N,vector<int>(N)); for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ cin>>S[i][j]; } } for(int i=0;i<N;i++) dp[(1<<i)][i]=1; for(int bit=0;bit<(1<<N);bit++){ int x=__builtin_popcount(bit); if(!(x==2||x==4||x==8||x==16)) continue; for(int T=bit;;T=(T-1)&bit){ int y=__builtin_popcount(T); if(y+y!=x){ if(T==0) break; else continue; } int U=bit-T; for(int i=0;i<N;i++){ if(!(T&(1<<i))) continue; for(int j=0;j<N;j++){ if(!(U&(1<<j))) continue; if(S[i][j]) dp[bit][i]+=dp[T][i]*dp[U][j]; else dp[bit][j]+=dp[T][i]*dp[U][j]; } } if(T==0) break; } } for(int i=0;i<N;i++) cout<<dp[(1<<N)-1][i]<<"\n"; }