結果
問題 | No.1937 Various Tournament |
ユーザー |
![]() |
提出日時 | 2022-05-13 21:49:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 896 bytes |
コンパイル時間 | 4,321 ms |
コンパイル使用メモリ | 260,096 KB |
最終ジャッジ日時 | 2025-01-29 06:53:46 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 TLE * 31 |
ソースコード
#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; vector<long long> ans; void dfs(vector<int> a,vector<int> b){ if(a.size()==0){ //cout<<b[0]<<endl; if(b.size()==1)ans[b[0]]++; else{ dfs(b,a); } 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); 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; } } ans.resize(n,0); vector<int> a(n); rep(i,n)a[i] = i; vector<int> b; dfs(a,b); rep(i,n)ans[i] *= 1LL<<(n-1); rep(i,n){ cout<<ans[i]<<endl; } return 0; }