結果

問題 No.2300 Substring OR Sum
ユーザー 👑 H20H20
提出日時 2023-05-19 09:24:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 622 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 259,220 KB
最終ジャッジ日時 2024-05-09 23:39:56
合計ジャッジ時間 8,277 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 38 ms
52,096 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 225 ms
89,620 KB
testcase_04 AC 202 ms
89,636 KB
testcase_05 AC 234 ms
91,568 KB
testcase_06 AC 153 ms
83,584 KB
testcase_07 AC 615 ms
135,932 KB
testcase_08 AC 290 ms
98,584 KB
testcase_09 AC 241 ms
91,648 KB
testcase_10 AC 524 ms
125,596 KB
testcase_11 AC 589 ms
137,020 KB
testcase_12 AC 622 ms
135,656 KB
testcase_13 AC 462 ms
259,220 KB
testcase_14 AC 523 ms
259,060 KB
testcase_15 AC 302 ms
98,076 KB
testcase_16 AC 525 ms
125,696 KB
testcase_17 AC 614 ms
142,612 KB
testcase_18 AC 38 ms
51,968 KB
testcase_19 AC 37 ms
52,096 KB
testcase_20 AC 37 ms
51,968 KB
testcase_21 AC 40 ms
52,096 KB
testcase_22 AC 38 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
A = list(map(int,input().split()))
ans = (2**28-1)*(N)*(N+1)//2
for i in range(28):
    temp = 0
    B = []
    for a in A:
        B.append(a&2**i>0)
    GB = itertools.groupby(B)
    for k,l in GB:
        if k==0:
            le = len(list(l))
            ans-=2**i*(le)*(le+1)//2
print(ans)
0