結果

問題 No.1505 Zero-Product Ranges
ユーザー O2MTO2MT
提出日時 2021-05-15 01:41:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,620 KB
実行使用メモリ 99,160 KB
最終ジャッジ日時 2024-04-10 06:41:26
合計ジャッジ時間 5,010 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,500 KB
testcase_01 AC 40 ms
52,628 KB
testcase_02 AC 39 ms
53,440 KB
testcase_03 AC 74 ms
97,028 KB
testcase_04 AC 73 ms
96,512 KB
testcase_05 AC 55 ms
74,656 KB
testcase_06 AC 55 ms
75,372 KB
testcase_07 AC 55 ms
71,436 KB
testcase_08 AC 53 ms
72,944 KB
testcase_09 AC 52 ms
72,692 KB
testcase_10 AC 52 ms
73,644 KB
testcase_11 AC 54 ms
74,748 KB
testcase_12 AC 50 ms
70,420 KB
testcase_13 AC 61 ms
82,408 KB
testcase_14 AC 58 ms
80,200 KB
testcase_15 AC 73 ms
97,152 KB
testcase_16 AC 77 ms
97,632 KB
testcase_17 AC 78 ms
97,568 KB
testcase_18 AC 78 ms
97,688 KB
testcase_19 AC 36 ms
52,616 KB
testcase_20 AC 37 ms
53,692 KB
testcase_21 AC 37 ms
52,656 KB
testcase_22 AC 77 ms
98,552 KB
testcase_23 AC 78 ms
99,160 KB
testcase_24 AC 77 ms
97,332 KB
testcase_25 AC 74 ms
93,984 KB
testcase_26 AC 77 ms
98,800 KB
testcase_27 AC 74 ms
95,504 KB
testcase_28 AC 73 ms
95,288 KB
testcase_29 AC 76 ms
98,304 KB
testcase_30 AC 77 ms
98,752 KB
testcase_31 AC 76 ms
97,904 KB
testcase_32 AC 60 ms
80,136 KB
testcase_33 AC 59 ms
78,524 KB
testcase_34 AC 61 ms
81,460 KB
testcase_35 AC 56 ms
75,648 KB
testcase_36 AC 58 ms
77,468 KB
testcase_37 AC 60 ms
80,224 KB
testcase_38 AC 59 ms
79,256 KB
testcase_39 AC 59 ms
78,596 KB
testcase_40 AC 60 ms
79,636 KB
testcase_41 AC 61 ms
81,292 KB
testcase_42 AC 44 ms
61,856 KB
testcase_43 AC 45 ms
63,752 KB
testcase_44 AC 45 ms
62,536 KB
testcase_45 AC 47 ms
63,816 KB
testcase_46 AC 44 ms
61,720 KB
testcase_47 AC 46 ms
63,748 KB
testcase_48 AC 44 ms
63,968 KB
testcase_49 AC 44 ms
60,728 KB
testcase_50 AC 45 ms
62,936 KB
testcase_51 AC 46 ms
63,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
ans = N*(N+1)//2
now = -1
flg = False
for i in range(N):
  if A[i] == 1:
    if flg == False:
      now = i
      flg = True
    ans -= (i-now+1)
  else:
    flg = False
    now = i

print(ans)
0