結果
| 問題 |
No.309 シャイな人たち (1)
|
| ユーザー |
|
| 提出日時 | 2016-02-17 21:34:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,633 bytes |
| コンパイル時間 | 1,448 ms |
| コンパイル使用メモリ | 169,012 KB |
| 実行使用メモリ | 10,400 KB |
| 最終ジャッジ日時 | 2024-09-22 07:36:47 |
| 合計ジャッジ時間 | 11,835 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 12 |
ソースコード
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
ld pers[11][11];
int shys[11][11];
vector<vector<ld>>hands;
int main() {
int R, C; cin >> R >> C;
hands.resize(R+1);
for (int i = 0; i < hands.size(); ++i){
hands[i].resize(1 << C);
}
for (int i = 0; i < R; ++i){
for (int j = 0; j < C; ++j){
cin >> pers[i][j];
pers[i][j] /= 100;
}
}
for (int i = 0; i < R; ++i){
for (int j = 0; j < C; ++j){
cin >> shys[i][j];
}
}
for (int i = 0; i < (1 << C); ++i){
hands[0][i] = 0;
}
hands[0][0] = 1;
ld ans = 0;
for (int r = 1; r <= R; ++r){
for (int k = 0; k < (1 << C); ++k){
for (int l = 0; l < (1 << C); ++l){
bitset<11>prehands(k),knows(l);
ld percentage = hands[r - 1][k];
bitset<11>ups(0);
vector<int>points(C);
for (int i = 0; i < C; ++i){
if (prehands[i]){
points[i] ++;
}
if (knows[i]){
points[i] += 4 - shys[r - 1][i];
percentage *= pers[r - 1][i];
}
else{
percentage *= 1-pers[r - 1][i];
}
}
for (int i = 0; i < C; ++i){
if (points[i] >= 4){
ups[i] = true;
if (i != 0)points[i - 1]++;
if (i != C - 1)points[i + 1] ++;
}
}
for (int i = C-1; i >=0; --i){
if (points[i] >= 4&&!ups[i]){
ups[i] = true;
if (i != 0)points[i - 1]++;
if (i != C - 1)points[i + 1] ++;
}
}
hands[r][ups.to_ulong()] += percentage;
ans += percentage*ups.count();
}
}
}
cout <<fixed<<setprecision(22)<< ans << endl;
return 0;
}