結果
| 問題 |
No.1245 ANDORゲーム(calc)
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2020-10-03 01:20:29 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 991 bytes |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 26,888 KB |
| 最終ジャッジ日時 | 2024-07-18 02:32:00 |
| 合計ジャッジ時間 | 33,028 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 TLE * 3 |
ソースコード
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)
titia