結果

問題 No.1245 ANDORゲーム(calc)
ユーザー mkawa2mkawa2
提出日時 2022-03-05 02:53:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 1,204 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 106,528 KB
最終ジャッジ日時 2023-09-26 06:42:16
合計ジャッジ時間 11,963 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,328 KB
testcase_01 AC 95 ms
71,196 KB
testcase_02 AC 96 ms
71,516 KB
testcase_03 AC 97 ms
71,504 KB
testcase_04 AC 97 ms
71,496 KB
testcase_05 AC 100 ms
71,328 KB
testcase_06 AC 96 ms
71,532 KB
testcase_07 AC 140 ms
77,868 KB
testcase_08 AC 121 ms
77,828 KB
testcase_09 AC 135 ms
78,020 KB
testcase_10 AC 139 ms
77,968 KB
testcase_11 AC 358 ms
105,928 KB
testcase_12 AC 347 ms
106,528 KB
testcase_13 AC 351 ms
106,136 KB
testcase_14 AC 343 ms
106,184 KB
testcase_15 AC 345 ms
106,312 KB
testcase_16 AC 343 ms
106,388 KB
testcase_17 AC 311 ms
106,324 KB
testcase_18 AC 311 ms
105,976 KB
testcase_19 AC 318 ms
105,836 KB
testcase_20 AC 330 ms
106,032 KB
testcase_21 AC 316 ms
105,788 KB
testcase_22 AC 317 ms
105,864 KB
testcase_23 AC 326 ms
106,408 KB
testcase_24 AC 315 ms
105,944 KB
testcase_25 AC 212 ms
104,396 KB
testcase_26 AC 236 ms
104,536 KB
testcase_27 AC 291 ms
105,456 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