結果
| 問題 | No.3615 Ge Gusser |
| コンテスト | |
| ユーザー |
tau1235
|
| 提出日時 | 2026-08-06 15:21:47 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 308 ms / 3,000 ms |
| + 449µs | |
| コード長 | 826 bytes |
| 記録 | |
| コンパイル時間 | 2,184 ms |
| コンパイル使用メモリ | 336,076 KB |
| 実行使用メモリ | 69,248 KB |
| 最終ジャッジ日時 | 2026-08-06 15:21:52 |
| 合計ジャッジ時間 | 4,418 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 3 |
| 小課題1 | 40 % | AC * 8 |
| 小課題2 | 40 % | AC * 15 |
| 小課題3 | 20 % | AC * 27 |
| 合計 | 2.5 * 100% = 250 点 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
void solve(){
using ull=unsigned long long;
int n,m;
cin>>n>>m;
vector<ull> a(n);
vector<ull> b(1<<n);
for (int i=0;i<n;i++){
string s;
cin>>s;
for (int j=0;j<m;j++){
a[i]+=(1LL<<j)*(s[j]=='o');
}
b[1<<i]=a[i];
}
b[0]=(1LL<<m)-1;
vector<double> dp(1<<n);
dp[0]=1;
double ans=0;
for (int bit=0;bit<1<<n;bit++){
ull mb=bit&(-bit);
if (bit) b[bit]=b[bit-mb]&b[mb];
if (__builtin_popcountll(b[bit])==1){
ans+=dp[bit]*__builtin_popcountll(bit);
continue;
}
int p=n-__builtin_popcountll(bit);
for (int i=0;i<n;i++){
if (bit>>i&1) ;
else dp[bit+(1<<i)]+=dp[bit]/p;
}
}
cout<<fixed<<setprecision(10);
cout<<ans<<endl;
}
int main(){
int t=1;
//cin>>t;
while (t--) solve();
}
tau1235