結果
| 問題 | No.2871 Universal Serial Bus |
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2024-09-06 21:48:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 693 bytes |
| 記録 | |
| コンパイル時間 | 309 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 52,608 KB |
| 最終ジャッジ日時 | 2026-04-04 00:31:12 |
| 合計ジャッジ時間 | 1,225 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 |
ソースコード
H,W=map(int,input().split())
# A=list(map(int, input().split()))
A=[]
for i in range(H):
s=input()
A.append(s)
B=[]
for i in range(H):
s=input()
B.append(s)
p,q=1,1
for h in range(H):
for w in range(W):
if A[h][w]==B[h][w]:
p=0
if A[h][w]==B[-1-h][-1-w]:
q=0
ans=3.5317401904617327
if p==0 and q==0:
print(-1)
elif p==1 and q==0:
ans=0;p=1
for i in range(100):
ans+=p
if i%2==0:
q=pow(2,i)
p/=q
print(ans)
elif p==0 and q==1:
ans=0;p=1
for i in range(100):
ans+=p
if i%2==1:
q=pow(2,i)
p/=q
print(ans)
else:
ans=0;p=1
for i in range(100):
ans+=p
q=pow(2,i)
p/=q
print(ans)
timi