結果
問題 |
No.2871 Universal Serial Bus
|
ユーザー |
![]() |
提出日時 | 2024-09-06 21:58:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 807 bytes |
コンパイル時間 | 341 ms |
コンパイル使用メモリ | 82,436 KB |
実行使用メモリ | 54,084 KB |
最終ジャッジ日時 | 2024-09-06 21:58:44 |
合計ジャッジ時間 | 1,855 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 WA * 5 |
ソースコード
H, W = map(int, input().split()) S = [] for _ in range(H): S.append(input()) T = [] Trev = [] for _ in range(H): s = input() s = s.replace(".", "@") s = s.replace("#", ".") s = s.replace("@", "#") Trev.append(s[::-1]) T.append(s) Trev = Trev[::-1] if S == T: pro = 1 n = 1 count = 1 ans = 0 while (10**10) > n: if count % 2 == 1: sub = 1 - 1 / n ans += sub * pro * count pro -= sub * pro n *= 2 count += 1 print(ans) elif S == Trev: pro = 1 n = 1 count = 1 ans = 0 while (10**10) > n: if count % 2 == 0: sub = 1 - 1 / n ans += sub * pro * count pro -= sub * pro n *= 2 count += 1 print(ans) else: print(-1)