結果
問題 |
No.1245 ANDORゲーム(calc)
|
ユーザー |
![]() |
提出日時 | 2020-10-03 01:20:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 217 ms / 2,000 ms |
コード長 | 991 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 82,200 KB |
実行使用メモリ | 99,728 KB |
最終ジャッジ日時 | 2024-07-18 02:31:22 |
合計ジャッジ時間 | 7,641 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
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)