結果

問題 No.1505 Zero-Product Ranges
ユーザー mesame3993mesame3993
提出日時 2021-09-30 01:00:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 853 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 121,024 KB
最終ジャッジ日時 2023-09-24 03:27:28
合計ジャッジ時間 8,304 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,204 KB
testcase_01 AC 73 ms
71,140 KB
testcase_02 AC 72 ms
71,528 KB
testcase_03 AC 107 ms
104,052 KB
testcase_04 WA -
testcase_05 AC 89 ms
85,868 KB
testcase_06 AC 90 ms
85,976 KB
testcase_07 AC 87 ms
83,312 KB
testcase_08 AC 88 ms
84,368 KB
testcase_09 AC 89 ms
83,416 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 119 ms
120,656 KB
testcase_16 AC 123 ms
111,756 KB
testcase_17 AC 128 ms
111,996 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 72 ms
71,280 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 121 ms
112,104 KB
testcase_24 AC 122 ms
111,856 KB
testcase_25 AC 113 ms
107,756 KB
testcase_26 AC 119 ms
111,728 KB
testcase_27 AC 119 ms
108,628 KB
testcase_28 AC 118 ms
108,708 KB
testcase_29 WA -
testcase_30 AC 125 ms
111,704 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 100 ms
94,560 KB
testcase_35 AC 95 ms
87,960 KB
testcase_36 AC 96 ms
90,048 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 102 ms
92,192 KB
testcase_40 AC 101 ms
92,220 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 84 ms
77,004 KB
testcase_44 AC 84 ms
76,464 KB
testcase_45 AC 83 ms
76,720 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 82 ms
76,784 KB
testcase_49 WA -
testcase_50 AC 82 ms
76,444 KB
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

li0 = [x for x in range(n) if a[x] == 0]
li0 = list(reversed(li0))
ans = 0

if 0 not in a:
	print(0)
	exit()
for i in range(n-1):
	if a[i] == 0:
		ans += n - i
		if i >= li0[-1]:
			li0.pop()
	else:
		if len(li0) == 0:
			break
		ans += n - i - (li0[-1]-i)		
print(ans)
0