結果

問題 No.2871 Universal Serial Bus
ユーザー 👑 rin204rin204
提出日時 2024-09-06 23:42:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 61,008 KB
最終ジャッジ日時 2024-09-06 23:42:46
合計ジャッジ時間 2,113 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
59,796 KB
testcase_01 AC 42 ms
59,776 KB
testcase_02 AC 44 ms
59,976 KB
testcase_03 WA -
testcase_04 AC 44 ms
59,692 KB
testcase_05 AC 44 ms
60,516 KB
testcase_06 AC 42 ms
59,500 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 44 ms
60,008 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 44 ms
60,080 KB
testcase_13 WA -
testcase_14 AC 44 ms
60,968 KB
testcase_15 AC 44 ms
61,008 KB
testcase_16 AC 44 ms
59,928 KB
testcase_17 AC 44 ms
59,856 KB
testcase_18 AC 44 ms
60,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
S = [input() for _ in range(h)]
T = [input() for _ in range(h)]

ok = []
for i in range(2):
    flg = True
    for i in range(h):
        for j in range(w):
            if S[i][j] == T[i][j]:
                flg = False
                break
        if not flg:
            break
    ok.append(flg)
    S = S[::-1]

ans = 0
p = 1
p2 = 1
for i in range(10000):
    if i % 2 == 0 and ok[i & 1]:
        ans += p2 * (1 - p) * (i + 1)
        p2 *= p
    elif i % 2 == 1 and ok[i & 1]:
        ans += p2 * (1 - p) * (i + 1)
        p2 *= p
    p /= 2
print(ans)
0