結果

問題 No.1245 ANDORゲーム(calc)
ユーザー titiatitia
提出日時 2020-10-03 01:20:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 991 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 24,256 KB
最終ジャッジ日時 2023-09-25 02:36:11
合計ジャッジ時間 32,823 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,808 KB
testcase_01 AC 17 ms
7,804 KB
testcase_02 AC 17 ms
7,792 KB
testcase_03 AC 16 ms
7,824 KB
testcase_04 AC 16 ms
7,768 KB
testcase_05 AC 16 ms
7,772 KB
testcase_06 AC 16 ms
7,784 KB
testcase_07 AC 58 ms
8,576 KB
testcase_08 AC 29 ms
8,432 KB
testcase_09 AC 53 ms
8,520 KB
testcase_10 AC 62 ms
8,552 KB
testcase_11 AC 1,945 ms
24,112 KB
testcase_12 AC 1,822 ms
24,256 KB
testcase_13 AC 1,926 ms
23,456 KB
testcase_14 AC 1,860 ms
23,948 KB
testcase_15 AC 1,961 ms
24,120 KB
testcase_16 AC 1,921 ms
24,000 KB
testcase_17 AC 1,750 ms
22,980 KB
testcase_18 AC 1,737 ms
23,296 KB
testcase_19 AC 1,755 ms
23,560 KB
testcase_20 AC 1,773 ms
23,136 KB
testcase_21 AC 1,731 ms
23,440 KB
testcase_22 AC 1,804 ms
23,868 KB
testcase_23 AC 1,662 ms
23,380 KB
testcase_24 AC 1,534 ms
23,832 KB
testcase_25 AC 1,169 ms
20,048 KB
testcase_26 AC 1,448 ms
20,092 KB
testcase_27 TLE -
権限があれば一括ダウンロードができます

ソースコード

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