結果

問題 No.2071 Shift and OR
ユーザー flygon
提出日時 2022-09-16 21:34:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 102,560 KB
最終ジャッジ日時 2024-12-21 18:30:32
合計ジャッジ時間 3,689 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
cnt = 0
#n <= 1<<60 以下くらい
def popcnt(n):
  c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
  c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
  c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
  c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
  c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
  c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
  return c
for i in range(n):
  cnt += popcnt(a[i])
ans = 0
for i in range(min(cnt, 16)):
  ans += pow(2, 15-i)

print(ans)
0