結果

問題 No.2300 Substring OR Sum
コンテスト
ユーザー rin204
提出日時 2024-03-16 16:06:59
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 330 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 119 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 109,440 KB
最終ジャッジ日時 2026-04-16 09:29:03
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(30):
    tot = 0
    row = 0
    for a in A:
        if a >> i & 1:
            tot += row * (row + 1) // 2
            row = 0
        else:
            row += 1
    tot += row * (row + 1) // 2
    ans += (n * (n + 1) // 2 - tot) * (1 << i)
print(ans)
0