結果

問題 No.1245 ANDORゲーム(calc)
ユーザー mkawa2mkawa2
提出日時 2020-10-03 09:27:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,204 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 9,092 KB
最終ジャッジ日時 2023-09-25 04:51:45
合計ジャッジ時間 4,893 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,672 KB
testcase_01 AC 20 ms
8,740 KB
testcase_02 AC 20 ms
8,796 KB
testcase_03 AC 20 ms
8,608 KB
testcase_04 AC 20 ms
8,656 KB
testcase_05 AC 20 ms
8,764 KB
testcase_06 AC 20 ms
8,764 KB
testcase_07 AC 110 ms
9,020 KB
testcase_08 AC 46 ms
8,864 KB
testcase_09 AC 104 ms
9,088 KB
testcase_10 AC 102 ms
9,092 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 -- -
権限があれば一括ダウンロードができます

ソースコード

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