結果
問題 | No.2300 Substring OR Sum |
ユーザー |
|
提出日時 | 2023-05-12 21:57:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 422 ms / 2,000 ms |
コード長 | 390 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 258,376 KB |
最終ジャッジ日時 | 2024-11-28 18:12:43 |
合計ジャッジ時間 | 5,792 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
n = int(input())A = list(map(int,input().split()))ans = 0for i in range(28):l = []for ind,a in enumerate(A):if a >> i & 1:l.append(ind)l = l[::-1]count = 0for ind,a in enumerate(A):if a >> i & 1:count += n-l[-1]l.pop()elif l:count += n - l[-1]ans += count << iprint(ans)