結果
| 問題 |
No.2871 Universal Serial Bus
|
| コンテスト | |
| ユーザー |
FplusFplusF
|
| 提出日時 | 2024-09-06 21:38:50 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,806 bytes |
| コンパイル時間 | 3,059 ms |
| コンパイル使用メモリ | 253,300 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-06 21:39:27 |
| 合計ジャッジ時間 | 34,203 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 4 WA * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define replr(i,l,r) for (ll i=(ll)(l);i<(ll)(r);i++)
#define all(v) v.begin(),v.end()
#define len(v) ((ll)v.size())
template<class T> inline bool chmin(T &a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T &a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
namespace timer{
auto start=chrono::system_clock::now();
void snap(){
start=chrono::system_clock::now();
}
int get_ms(){
auto now=chrono::system_clock::now();
int ms=chrono::duration_cast<chrono::milliseconds>(now-start).count();
return ms;
}
}
mt19937 mt;
inline double rand_double(){ //[0.0,1.0]
return (double)mt()/(double)mt19937::max();
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll h,w;
cin >> h >> w;
vector<string> s(h),t(h);
rep(i,h) cin >> s[i];
rep(i,h) cin >> t[i];
vector<ll> v(2,true);
rep(i,h){
rep(j,w){
if(s[i][j]==t[i][j]) v[0]=false;
}
}
reverse(all(s));
rep(i,h) reverse(all(s[i]));
rep(i,h){
rep(j,w){
if(s[i][j]==t[i][j]) v[1]=false;
}
}
if(!v[0]&&!v[1]){
cout << "-1\n";
return 0;
}
ll cnt=0,sum=0;
while(timer::get_ms()<1900){
ll now=1;
while(true){
if(v[1-(now&1)]&&rand_double()<1-pow(2,-(now-1))) break;
now++;
}
cnt++;
sum+=now;
}
cout << fixed << setprecision(20) << (ld)sum/(ld)cnt << '\n';
}
FplusFplusF