結果
| 問題 |
No.2871 Universal Serial Bus
|
| コンテスト | |
| ユーザー |
Rubikun
|
| 提出日時 | 2024-09-06 22:19:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,833 bytes |
| コンパイル時間 | 2,120 ms |
| コンパイル使用メモリ | 199,500 KB |
| 最終ジャッジ日時 | 2025-02-24 04:30:45 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;
#define ld long double
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int H,W;cin>>H>>W;
vector<string> S(H),T(H);
for(int i=0;i<H;i++) cin>>S[i];
for(int i=0;i<H;i++) cin>>T[i];
vector<int> ok(2);
for(int q=0;q<2;q++){
bool f=true;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(S[i][j]=='#'&&T[i][j]=='#') f=false;
}
}
ok[q]=f;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(i<H-1-i&&j<W-1-j) swap(S[i][j],S[H-1-i][W-1-j]);
}
}
}
if(ok[0]==0&&ok[1]==0){
cout<<-1<<endl;
return 0;
}
ld ans=0,P=1;
for(ll i=1;i<=101;i++){
if(ok[(i-1)&1]){
ld X=P*(1.0l-powl(0.5,i-1));
ans+=X*i;
P*=powl(0.5,i-1);
}
}
cout<<fixed<<setprecision(25)<<ans<<endl;
}
Rubikun