結果
問題 | No.2871 Universal Serial Bus |
ユーザー | 👑 rin204 |
提出日時 | 2024-09-06 23:43:09 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 644 bytes |
コンパイル時間 | 322 ms |
コンパイル使用メモリ | 82,916 KB |
実行使用メモリ | 61,516 KB |
最終ジャッジ日時 | 2024-09-06 23:43:11 |
合計ジャッジ時間 | 2,153 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
60,816 KB |
testcase_01 | AC | 43 ms
59,856 KB |
testcase_02 | AC | 45 ms
60,076 KB |
testcase_03 | AC | 38 ms
52,924 KB |
testcase_04 | AC | 45 ms
60,928 KB |
testcase_05 | AC | 45 ms
60,680 KB |
testcase_06 | AC | 44 ms
59,940 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 45 ms
60,136 KB |
testcase_10 | AC | 38 ms
52,592 KB |
testcase_11 | WA | - |
testcase_12 | AC | 44 ms
60,036 KB |
testcase_13 | AC | 39 ms
53,652 KB |
testcase_14 | AC | 45 ms
60,352 KB |
testcase_15 | AC | 45 ms
61,516 KB |
testcase_16 | AC | 44 ms
59,968 KB |
testcase_17 | AC | 46 ms
61,072 KB |
testcase_18 | AC | 45 ms
60,672 KB |
ソースコード
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] if not ok[0] and not ok[1]: print(-1) exit() 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)