結果

問題 No.1505 Zero-Product Ranges
ユーザー AAAR SalmonAAAR Salmon
提出日時 2021-05-14 22:14:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,208 KB
最終ジャッジ日時 2024-04-10 00:34:59
合計ジャッジ時間 5,454 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,880 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 26 ms
10,880 KB
testcase_03 AC 86 ms
14,176 KB
testcase_04 AC 116 ms
14,052 KB
testcase_05 AC 62 ms
12,296 KB
testcase_06 AC 64 ms
12,260 KB
testcase_07 AC 51 ms
11,880 KB
testcase_08 AC 57 ms
11,904 KB
testcase_09 AC 55 ms
12,032 KB
testcase_10 AC 58 ms
11,964 KB
testcase_11 AC 62 ms
12,288 KB
testcase_12 AC 49 ms
11,904 KB
testcase_13 AC 76 ms
13,080 KB
testcase_14 AC 75 ms
12,856 KB
testcase_15 AC 108 ms
14,172 KB
testcase_16 AC 118 ms
14,176 KB
testcase_17 AC 122 ms
14,048 KB
testcase_18 AC 120 ms
14,068 KB
testcase_19 AC 29 ms
10,880 KB
testcase_20 AC 29 ms
11,008 KB
testcase_21 AC 28 ms
10,880 KB
testcase_22 AC 123 ms
14,020 KB
testcase_23 AC 116 ms
14,208 KB
testcase_24 AC 120 ms
14,068 KB
testcase_25 AC 111 ms
14,116 KB
testcase_26 AC 116 ms
14,196 KB
testcase_27 AC 111 ms
14,112 KB
testcase_28 AC 115 ms
14,100 KB
testcase_29 AC 119 ms
14,088 KB
testcase_30 AC 121 ms
14,040 KB
testcase_31 AC 113 ms
14,156 KB
testcase_32 AC 72 ms
12,796 KB
testcase_33 AC 70 ms
12,536 KB
testcase_34 AC 76 ms
12,888 KB
testcase_35 AC 64 ms
12,172 KB
testcase_36 AC 67 ms
12,316 KB
testcase_37 AC 74 ms
12,788 KB
testcase_38 AC 69 ms
12,356 KB
testcase_39 AC 73 ms
12,404 KB
testcase_40 AC 75 ms
12,788 KB
testcase_41 AC 78 ms
12,940 KB
testcase_42 AC 33 ms
11,136 KB
testcase_43 AC 35 ms
11,136 KB
testcase_44 AC 34 ms
11,136 KB
testcase_45 AC 34 ms
11,264 KB
testcase_46 AC 31 ms
11,008 KB
testcase_47 AC 35 ms
11,136 KB
testcase_48 AC 31 ms
11,264 KB
testcase_49 AC 31 ms
11,008 KB
testcase_50 AC 34 ms
11,136 KB
testcase_51 AC 38 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
from math import sin, cos, tan
from functools import reduce
from collections import deque
import heapq
sys.setrecursionlimit(1000000)
intm1 = lambda x:int(x)-1

N = int(input())
A = list(map(int,input().split()))

ans = 0
pre0 = -1
for i in range(N):
	if A[i] == 0:
		ans += i + 1
		pre0 = i
	else:
		if pre0 != -1:
			ans += pre0 + 1
print(ans)
0