結果
| 問題 | No.1937 Various Tournament |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2022-05-13 21:54:24 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,125 bytes |
| 記録 | |
| コンパイル時間 | 3,362 ms |
| コンパイル使用メモリ | 288,592 KB |
| 実行使用メモリ | 237,824 KB |
| 最終ジャッジ日時 | 2026-06-26 01:33:16 |
| 合計ジャッジ時間 | 7,346 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 1 TLE * 1 -- * 45 |
ソースコード
#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;
map<vector<int>,long long> mp;
void dfs(vector<int> a,vector<int> b,long long num){
if(a.size()==0){
//cout<<b[0]<<endl;
mp[b] += num;
return;
}
int x = a.back();
a.pop_back();
rep(i,a.size()){
int y = a.back();
a.pop_back();
if(s[x][y]=='1')b.push_back(x);
else b.push_back(y);
dfs(a,b,num);
b.pop_back();
a.insert(a.begin(),y);
}
}
int main(){
cin>>n;
s.resize(n,"");
rep(i,n){
rep(j,n){
int t;
cin>>t;
s[i] += '0'+t;
}
}
//mp[
//ans.resize(n,0);
vector<int> a(n);
rep(i,n)a[i] = i;
mp[a] ++;
int nn = n;
while(n!=1){
vector<int> b;
map<vector<int>,long long> nmp = mp;
mp.clear();
for(auto x:nmp){
dfs(x.first,b,x.second);
}
n>>=1;
}
n = nn;
vector<long long> ans(n,0);
for(auto x:mp){
ans[x.first[0]] += x.second;
}
rep(i,n)ans[i] *= 1LL<<(n-1);
rep(i,n){
cout<<ans[i]<<endl;
}
return 0;
}
沙耶花