結果
問題 |
No.1245 ANDORゲーム(calc)
|
ユーザー |
|
提出日時 | 2022-07-06 21:36:16 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 322 ms / 2,000 ms |
コード長 | 584 bytes |
コンパイル時間 | 373 ms |
コンパイル使用メモリ | 82,296 KB |
実行使用メモリ | 94,336 KB |
最終ジャッジ日時 | 2024-12-23 07:12:00 |
合計ジャッジ時間 | 7,756 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
n, Q = map(int, input().split()) A = list(map(int, input().split())) S = input() cnt = [[0] * 2 for _ in range(30)] for i in range(30): for j in range(2): if j == 0: x = 0 else: x = 1 << i for a, s in zip(A, S): b = (a >> i & 1) << i if s == "0": nx = x & b else: nx = x | b cnt[i][j] += abs(x - nx) x = nx T = list(map(int, input().split())) for t in T: ans = 0 for i in range(30): ans += cnt[i][t >> i & 1] print(ans)