結果

問題 No.1505 Zero-Product Ranges
ユーザー あかりきあかりき
提出日時 2021-05-23 13:34:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 102,292 KB
最終ジャッジ日時 2024-04-19 20:30:27
合計ジャッジ時間 5,343 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,004 KB
testcase_01 AC 32 ms
52,492 KB
testcase_02 AC 33 ms
53,284 KB
testcase_03 AC 73 ms
100,904 KB
testcase_04 AC 72 ms
100,236 KB
testcase_05 AC 52 ms
76,916 KB
testcase_06 AC 52 ms
77,328 KB
testcase_07 AC 50 ms
73,480 KB
testcase_08 AC 52 ms
74,752 KB
testcase_09 AC 51 ms
73,460 KB
testcase_10 AC 52 ms
75,228 KB
testcase_11 AC 54 ms
77,604 KB
testcase_12 AC 49 ms
71,888 KB
testcase_13 AC 62 ms
85,244 KB
testcase_14 AC 61 ms
82,220 KB
testcase_15 AC 74 ms
99,100 KB
testcase_16 AC 79 ms
102,292 KB
testcase_17 AC 80 ms
101,912 KB
testcase_18 AC 78 ms
100,960 KB
testcase_19 AC 33 ms
51,996 KB
testcase_20 AC 35 ms
52,592 KB
testcase_21 AC 34 ms
53,148 KB
testcase_22 AC 77 ms
101,444 KB
testcase_23 AC 81 ms
101,216 KB
testcase_24 AC 78 ms
101,148 KB
testcase_25 AC 74 ms
96,632 KB
testcase_26 AC 76 ms
101,520 KB
testcase_27 AC 72 ms
96,364 KB
testcase_28 AC 72 ms
97,220 KB
testcase_29 AC 78 ms
100,792 KB
testcase_30 AC 77 ms
101,292 KB
testcase_31 AC 76 ms
100,652 KB
testcase_32 AC 61 ms
82,200 KB
testcase_33 AC 60 ms
80,708 KB
testcase_34 AC 66 ms
84,108 KB
testcase_35 AC 60 ms
76,500 KB
testcase_36 AC 57 ms
78,792 KB
testcase_37 AC 63 ms
82,200 KB
testcase_38 AC 59 ms
81,212 KB
testcase_39 AC 58 ms
81,304 KB
testcase_40 AC 59 ms
81,864 KB
testcase_41 AC 61 ms
84,672 KB
testcase_42 AC 43 ms
63,748 KB
testcase_43 AC 45 ms
65,620 KB
testcase_44 AC 44 ms
64,356 KB
testcase_45 AC 44 ms
64,860 KB
testcase_46 AC 44 ms
63,200 KB
testcase_47 AC 44 ms
64,740 KB
testcase_48 AC 43 ms
63,860 KB
testcase_49 AC 46 ms
62,692 KB
testcase_50 AC 43 ms
64,248 KB
testcase_51 AC 45 ms
66,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
L=[-1]*(n+1)
for i in range(n):
  if a[i]==0:
    L[i]=i
L[-1]=n+1
for i in range(n-1,-1,-1):
  if L[i]==-1:
    L[i]=L[i+1]

ans=0
for i in range(n):
  ans+=max(n-L[i],0)
print(ans)
0