結果
問題 | No.1245 ANDORゲーム(calc) |
ユーザー | Eki1009 |
提出日時 | 2020-10-02 22:20:39 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 621 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 10,876 KB |
実行使用メモリ | 8,576 KB |
最終ジャッジ日時 | 2023-09-24 21:17:46 |
合計ジャッジ時間 | 4,833 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,828 KB |
testcase_01 | AC | 15 ms
7,776 KB |
testcase_02 | AC | 17 ms
7,824 KB |
testcase_03 | AC | 18 ms
7,824 KB |
testcase_04 | AC | 17 ms
7,772 KB |
testcase_05 | AC | 16 ms
7,800 KB |
testcase_06 | AC | 16 ms
7,800 KB |
testcase_07 | AC | 122 ms
8,576 KB |
testcase_08 | AC | 44 ms
8,336 KB |
testcase_09 | AC | 109 ms
8,224 KB |
testcase_10 | AC | 105 ms
8,452 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
ソースコード
n, q = map(int, input().split()) A = list(map(int, input().split())) S = input() U = 31 dp = [[0]*U for _ in range(2)] for i in range(2): for j in range(U): now, temp = i, 0 for k, a in enumerate(A): if S[k] == "0": nxt = now & (a>>j & 1) temp += now - nxt now = nxt else: nxt = now | (a>>j & 1) temp += nxt - now now = nxt dp[i][j] = temp T = list(map(int, input().split())) for t in T: ans = 0 for j in range(U): ans += dp[t>>j & 1][j] << j print(ans)