結果
問題 |
No.2300 Substring OR Sum
|
ユーザー |
👑 |
提出日時 | 2024-03-16 16:06:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 160 ms / 2,000 ms |
コード長 | 330 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 108,188 KB |
最終ジャッジ日時 | 2024-09-30 04:05:10 |
合計ジャッジ時間 | 3,746 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
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)