結果

問題 No.2300 Substring OR Sum
ユーザー 👑 H20H20
提出日時 2023-05-19 09:24:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 671 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 86,752 KB
実行使用メモリ 259,628 KB
最終ジャッジ日時 2023-08-22 17:51:15
合計ジャッジ時間 9,799 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,544 KB
testcase_01 AC 72 ms
71,500 KB
testcase_02 AC 68 ms
71,544 KB
testcase_03 AC 268 ms
91,152 KB
testcase_04 AC 221 ms
90,900 KB
testcase_05 AC 255 ms
93,024 KB
testcase_06 AC 169 ms
85,068 KB
testcase_07 AC 644 ms
149,396 KB
testcase_08 AC 309 ms
98,408 KB
testcase_09 AC 264 ms
93,748 KB
testcase_10 AC 550 ms
126,456 KB
testcase_11 AC 635 ms
139,004 KB
testcase_12 AC 661 ms
149,408 KB
testcase_13 AC 512 ms
259,628 KB
testcase_14 AC 541 ms
259,452 KB
testcase_15 AC 333 ms
101,112 KB
testcase_16 AC 549 ms
128,628 KB
testcase_17 AC 671 ms
149,404 KB
testcase_18 AC 67 ms
71,520 KB
testcase_19 AC 68 ms
71,416 KB
testcase_20 AC 70 ms
71,368 KB
testcase_21 AC 68 ms
71,304 KB
testcase_22 AC 68 ms
71,188 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