結果

問題 No.2871 Universal Serial Bus
ユーザー kaede2020
提出日時 2024-09-06 22:10:29
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 6,372 ms
コンパイル使用メモリ 337,656 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-06 22:11:23
合計ジャッジ時間 7,112 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#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]){
            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/bai)*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;
}
0