結果

問題 No.1245 ANDORゲーム(calc)
ユーザー titiatitia
提出日時 2020-10-03 01:20:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 98,172 KB
最終ジャッジ日時 2023-09-25 02:35:26
合計ジャッジ時間 8,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,392 KB
testcase_01 AC 70 ms
71,348 KB
testcase_02 AC 69 ms
71,312 KB
testcase_03 AC 74 ms
71,252 KB
testcase_04 AC 69 ms
71,432 KB
testcase_05 AC 70 ms
71,440 KB
testcase_06 AC 71 ms
71,312 KB
testcase_07 AC 101 ms
77,120 KB
testcase_08 AC 99 ms
76,932 KB
testcase_09 AC 99 ms
76,936 KB
testcase_10 AC 101 ms
77,816 KB
testcase_11 AC 254 ms
95,740 KB
testcase_12 AC 249 ms
95,996 KB
testcase_13 AC 256 ms
95,872 KB
testcase_14 AC 257 ms
95,772 KB
testcase_15 AC 252 ms
95,984 KB
testcase_16 AC 257 ms
95,828 KB
testcase_17 AC 235 ms
95,812 KB
testcase_18 AC 235 ms
96,008 KB
testcase_19 AC 234 ms
96,052 KB
testcase_20 AC 239 ms
95,948 KB
testcase_21 AC 235 ms
95,960 KB
testcase_22 AC 243 ms
95,952 KB
testcase_23 AC 236 ms
95,804 KB
testcase_24 AC 215 ms
95,852 KB
testcase_25 AC 148 ms
97,880 KB
testcase_26 AC 182 ms
98,172 KB
testcase_27 AC 223 ms
94,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,Q=map(int,input().split())
A=list(map(int,input().split()))
S=input().strip()
T=list(map(int,input().split()))

X=[-1]*31
X2=[-1]*31
score=0

for i in range(N):
    a=A[i]
    s=int(S[i])
    for j in range(31):
        if a & (1<<j) == 0:
            if s==0:
                if X[j]==-1:
                    X[j]=0
                    X2[j]=0
                elif X2[j]==1:
                    X2[j]=0
                    score+=1<<j
        else:
            if s==1:
                if X[j]==-1:
                    X[j]=1
                    X2[j]=1
                elif X2[j]==0:
                    X2[j]=1
                    score+=1<<j
    #print(X)

for t in T:
    score2=0
    for j in range(31):
        if X[j]==0:
            if t & (1<<j) !=0:
                score2+=1<<j
        elif X[j]==1:
            if t & (1<<j) ==0:
                score2+=1<<j

    print(score+score2)
            
                
            
         
0