結果
問題 | No.1245 ANDORゲーム(calc) |
ユーザー | yuusanlondon |
提出日時 | 2020-10-02 22:06:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 433 ms / 2,000 ms |
コード長 | 779 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 87,244 KB |
実行使用メモリ | 99,384 KB |
最終ジャッジ日時 | 2023-09-24 12:35:12 |
合計ジャッジ時間 | 9,870 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,376 KB |
testcase_01 | AC | 69 ms
71,424 KB |
testcase_02 | AC | 71 ms
71,248 KB |
testcase_03 | AC | 71 ms
71,348 KB |
testcase_04 | AC | 70 ms
71,312 KB |
testcase_05 | AC | 69 ms
71,448 KB |
testcase_06 | AC | 70 ms
71,348 KB |
testcase_07 | AC | 116 ms
77,864 KB |
testcase_08 | AC | 102 ms
77,900 KB |
testcase_09 | AC | 116 ms
77,880 KB |
testcase_10 | AC | 111 ms
77,920 KB |
testcase_11 | AC | 433 ms
96,712 KB |
testcase_12 | AC | 410 ms
96,760 KB |
testcase_13 | AC | 406 ms
95,936 KB |
testcase_14 | AC | 426 ms
96,616 KB |
testcase_15 | AC | 405 ms
96,580 KB |
testcase_16 | AC | 410 ms
96,596 KB |
testcase_17 | AC | 374 ms
96,720 KB |
testcase_18 | AC | 352 ms
96,656 KB |
testcase_19 | AC | 359 ms
96,648 KB |
testcase_20 | AC | 376 ms
96,956 KB |
testcase_21 | AC | 375 ms
96,780 KB |
testcase_22 | AC | 354 ms
96,492 KB |
testcase_23 | AC | 382 ms
95,996 KB |
testcase_24 | AC | 368 ms
96,528 KB |
testcase_25 | AC | 260 ms
99,292 KB |
testcase_26 | AC | 267 ms
99,384 KB |
testcase_27 | AC | 312 ms
95,660 KB |
ソースコード
n,q=map(int,input().split()) a=list(map(int,input().split())) s=input() t=list(map(int,input().split())) score=[] for i in range(40): score.append([]) score[-1].append(0) score[-1].append(0) for i in range(40): k=1<<i current=0 for j in range(n): if current==0 and s[j]=='1' and k&a[j]: score[i][0]+=1 current=1 if current==1 and s[j]=='0' and not (k&a[j]): score[i][0]+=1 current=0 current=1 for j in range(n): if current==0 and s[j]=='1' and k&a[j]: score[i][1]+=1 current=1 if current==1 and s[j]=='0' and not (k&a[j]): score[i][1]+=1 current=0 for i in range(q): ans=0 for j in range(40): if t[i]&(1<<j): ans+=(1<<j)*score[j][1] else: ans+=(1<<j)*score[j][0] print(ans)