結果
| 問題 |
No.2871 Universal Serial Bus
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2024-09-06 21:27:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 849 bytes |
| コンパイル時間 | 4,183 ms |
| コンパイル使用メモリ | 255,216 KB |
| 最終ジャッジ日時 | 2025-02-24 04:00:43 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 WA * 4 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001
bool check(vector<string> x,vector<string> y){
rep(i,x.size()){
rep(j,x[i].size()){
if(x[i][j]==y[i][j])return false;
}
}
return true;
}
int main(){
int h,w;
cin>>h>>w;
vector<string> s(h),t(h);
rep(i,h)cin>>s[i];
rep(i,h)cin>>t[i];
bool f0 = check(s,t);
rep(i,h){
reverse(t[i].begin(),t[i].end());
}
reverse(t.begin(),t.end());
bool f1 = check(s,t);
double ans = 0,cp = 1;
rep(i,5000000){
double p = 0;
if(i%2==0&&f0)p = 1-pow(2.0,-i);
if(i%2==1&&f1)p = 1-pow(2.0,-i);
ans += cp*p*(i+1);
cp *= 1-p;
}
cout<<fixed<<setprecision(10)<<ans<<endl;
return 0;
}
沙耶花