結果
| 問題 |
No.2871 Universal Serial Bus
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-06 22:07:31 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,067 bytes |
| コンパイル時間 | 8,001 ms |
| コンパイル使用メモリ | 338,236 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-06 22:08:30 |
| 合計ジャッジ時間 | 6,582 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using mint = modint998244353;
#define ull unsigned long long
random_device rnd;
mt19937 mt(rnd());
int RandInt(int a, int b) {
return a + mt() % (b - a + 1);
}
int masu_a[22][22];
int masu_b[22][22];
int main(){
int h,w;
cin>>h>>w;
vector<string> s(h);
rep(i,h) cin>>s[i];
vector<string>t(h);
rep(i,h) cin>>t[i];
double ans=0;
int cnt=0;
rep(i,h)rep(j,w){
if(s[i][j]!=t[i][j]) cnt++;
}
if(cnt!=h*w){
cout<<-1<<endl;
return 0;
}
double bai=1.0;
double tmp=0.0,nokori=1.0;
for(int i=1;i<=h*w;i++){
tmp=(1.0-1.0/pow(2,i-1))*nokori;
//cerr<<tmp<<" "<<nokori<<endl;
if(i%2==1){
ans+=(double)i*tmp;
//cerr<<"i:"<<i<<" "<<tmp<<endl;
nokori-=tmp;
}
bai*=2.0;
}
cout<<fixed<<setprecision(10)<<ans<<endl;
return 0;
}