結果

問題 No.1245 ANDORゲーム(calc)
ユーザー mkawa2mkawa2
提出日時 2020-10-03 09:28:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 335 ms / 2,000 ms
コード長 1,204 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 106,572 KB
最終ジャッジ日時 2023-09-25 04:51:55
合計ジャッジ時間 9,067 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,780 KB
testcase_01 AC 88 ms
71,504 KB
testcase_02 AC 90 ms
71,552 KB
testcase_03 AC 89 ms
71,548 KB
testcase_04 AC 91 ms
71,632 KB
testcase_05 AC 93 ms
71,532 KB
testcase_06 AC 90 ms
71,776 KB
testcase_07 AC 141 ms
78,152 KB
testcase_08 AC 113 ms
77,868 KB
testcase_09 AC 125 ms
78,196 KB
testcase_10 AC 120 ms
78,008 KB
testcase_11 AC 332 ms
106,444 KB
testcase_12 AC 335 ms
106,572 KB
testcase_13 AC 334 ms
106,428 KB
testcase_14 AC 327 ms
106,348 KB
testcase_15 AC 326 ms
106,268 KB
testcase_16 AC 330 ms
106,536 KB
testcase_17 AC 297 ms
106,152 KB
testcase_18 AC 291 ms
106,112 KB
testcase_19 AC 300 ms
106,156 KB
testcase_20 AC 311 ms
106,252 KB
testcase_21 AC 292 ms
106,388 KB
testcase_22 AC 300 ms
106,124 KB
testcase_23 AC 315 ms
106,512 KB
testcase_24 AC 297 ms
106,096 KB
testcase_25 AC 198 ms
104,616 KB
testcase_26 AC 217 ms
104,476 KB
testcase_27 AC 277 ms
105,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

# input=sys.stdin.buffer.readline
input=sys.stdin.readline

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return input()[:-1]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

n,q=MI()
aa=LI()
ss=SI()
tt=LI()
start=[-1]*30
base=0
for k in range(30):
    pre = -1
    for s, a in zip(ss, aa):
        d=a>>k&1
        if pre!=-1:
            if s=="0":cur=pre&d
            else:cur=pre|d
            base+=(pre^cur)<<k
            pre=cur
        if d==int(s) and start[k]==-1:
            start[k]=d
            pre=d
# print(base,start)

for t in tt:
    ans=base
    for k in range(30):
        if start[k]==-1:continue
        ans+=((t>>k&1)^start[k])<<k
    print(ans)
0