結果
| 問題 | No.3615 Ge Gusser |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-06 21:46:02 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,058 bytes |
| 記録 | |
| コンパイル時間 | 2,496 ms |
| コンパイル使用メモリ | 336,472 KB |
| 実行使用メモリ | 36,480 KB |
| 最終ジャッジ日時 | 2026-08-06 21:46:12 |
| 合計ジャッジ時間 | 7,979 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 3 |
| 小課題1 | 40 % | AC * 6 WA * 2 |
| 小課題2 | 40 % | AC * 10 WA * 5 |
| 小課題3 | 20 % | AC * 18 WA * 9 |
| 合計 | 2.5 * 0% = 0 点 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<ll> a(n, 0);
rep(i, n) {
string s;
cin >> s;
rep(j, m) {
if (s[j] == 'o')
a[i] += 1 << j;
}
}
vector<double> dp(1 << n, -1);
function<double(int)> rec = [&](int i) {
ll x = (1LL << 60) - 1;
if (dp[i] != -1)
return dp[i];
rep(j, n) {
if (i >> j & 1) {
x &= a[j];
}
}
if (__builtin_popcount(x) == 1) {
return dp[i] = 0;
}
int cnt = 0;
double ans = 0;
rep(j, n) {
if (i >> j & 1)
continue;
ans += rec(i ^ 1 << j);
cnt++;
}
return dp[i] = ans / cnt + 1;
};
cout << fixed << setprecision(12);
cout << rec(0) << endl;
return 0;
}