結果

問題 No.2300 Substring OR Sum
ユーザー prussian_coderprussian_coder
提出日時 2023-05-25 21:00:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 243 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 176,492 KB
最終ジャッジ日時 2023-08-25 23:35:37
合計ジャッジ時間 5,840 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,528 KB
testcase_01 AC 67 ms
71,412 KB
testcase_02 AC 64 ms
71,580 KB
testcase_03 AC 116 ms
105,728 KB
testcase_04 AC 113 ms
100,652 KB
testcase_05 AC 121 ms
107,472 KB
testcase_06 AC 97 ms
91,168 KB
testcase_07 AC 240 ms
172,884 KB
testcase_08 AC 138 ms
118,352 KB
testcase_09 AC 127 ms
109,716 KB
testcase_10 AC 199 ms
141,044 KB
testcase_11 AC 213 ms
154,488 KB
testcase_12 AC 234 ms
173,508 KB
testcase_13 AC 190 ms
176,492 KB
testcase_14 AC 84 ms
91,828 KB
testcase_15 AC 143 ms
121,576 KB
testcase_16 AC 194 ms
141,532 KB
testcase_17 AC 243 ms
171,128 KB
testcase_18 AC 64 ms
71,304 KB
testcase_19 AC 63 ms
71,152 KB
testcase_20 AC 63 ms
71,160 KB
testcase_21 AC 64 ms
71,148 KB
testcase_22 AC 62 ms
71,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[int(x) for x in input().split()]
ans=0
t=1
M=max(A)
while t<=M:
	B=[a%2 for a in A]
	x = N*(N+1)//2
	a=0
	for b in B:
		if b:
			x-=a*(a+1)//2
			a=0
		else:
			a+=1
	x-=a*(a+1)//2
	ans+=t*x
	t*=2
	A=[a//2 for a in A]
print(ans)
0