結果
| 問題 | No.753 最強王者決定戦 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-10 00:59:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,201 bytes |
| コンパイル時間 | 1,993 ms |
| コンパイル使用メモリ | 203,268 KB |
| 最終ジャッジ日時 | 2025-01-06 18:47:39 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
vector<vector<int>> A(16, vector<int>(16));
for (int i = 0; i < 16; ++i)
for (int j = 0; j < 16; ++j)
cin >> A[i][j];
for (int i = 0; i < 16; ++i)
for (int j = 0; j < i; ++j)
A[i][j] = -A[j][i];
vector<vector<int>> bin_set(1 << 16);
for (int i = 0; i < 1 << 16; ++i)
for (int j = 0; j < 16; ++j)
if (i >> j & 1)
bin_set[i].push_back(j);
vector<vector<int64_t>> dp(16, vector<int64_t>(1 << 16));
for (int i = 0; i < 16; ++i) dp[i][1 << i] = 1;
for (int s = 1; s < 1 << 16; ++s) {
int bc_s = __builtin_popcount(s);
if (bc_s < 2 || __builtin_popcount(bc_s) > 1) continue;
for (int a = s; a; a = (a - 1) & s) {
if (__builtin_popcount(a) * 2 != __builtin_popcount(s)) continue;
int b = s ^ a;
for (int i : bin_set[a])
for (int j : bin_set[b])
dp[A[i][j] > 0 ? i : j][s] += dp[i][a] * dp[j][b];
}
}
vector<int64_t> ans(16);
for (int i = 0; i < 16; ++i) ans[i] = accumulate(dp[i].begin(), dp[i].end(), 0LL);
copy(ans.begin(), ans.end(), ostream_iterator<int64_t>(cout, "\n"));
return 0;
}