結果

問題 No.1505 Zero-Product Ranges
ユーザー kohei2019kohei2019
提出日時 2022-06-18 11:47:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 97,792 KB
最終ジャッジ日時 2024-04-18 05:53:30
合計ジャッジ時間 5,482 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 36 ms
51,584 KB
testcase_02 AC 36 ms
51,840 KB
testcase_03 AC 71 ms
96,768 KB
testcase_04 AC 70 ms
96,640 KB
testcase_05 AC 52 ms
73,728 KB
testcase_06 AC 55 ms
73,856 KB
testcase_07 AC 48 ms
70,272 KB
testcase_08 AC 51 ms
72,192 KB
testcase_09 AC 49 ms
70,528 KB
testcase_10 AC 50 ms
72,064 KB
testcase_11 AC 52 ms
73,600 KB
testcase_12 AC 48 ms
69,120 KB
testcase_13 AC 59 ms
82,944 KB
testcase_14 AC 58 ms
80,000 KB
testcase_15 AC 70 ms
96,128 KB
testcase_16 AC 73 ms
97,280 KB
testcase_17 AC 73 ms
97,280 KB
testcase_18 AC 73 ms
97,280 KB
testcase_19 AC 35 ms
51,840 KB
testcase_20 AC 35 ms
52,096 KB
testcase_21 AC 35 ms
51,840 KB
testcase_22 AC 72 ms
96,768 KB
testcase_23 AC 71 ms
97,152 KB
testcase_24 AC 71 ms
96,640 KB
testcase_25 AC 68 ms
93,184 KB
testcase_26 AC 71 ms
96,832 KB
testcase_27 AC 68 ms
93,440 KB
testcase_28 AC 68 ms
93,824 KB
testcase_29 AC 71 ms
97,024 KB
testcase_30 AC 73 ms
97,792 KB
testcase_31 AC 72 ms
96,640 KB
testcase_32 AC 55 ms
78,720 KB
testcase_33 AC 56 ms
77,696 KB
testcase_34 AC 58 ms
79,872 KB
testcase_35 AC 53 ms
74,368 KB
testcase_36 AC 53 ms
75,776 KB
testcase_37 AC 56 ms
78,080 KB
testcase_38 AC 54 ms
77,568 KB
testcase_39 AC 58 ms
77,696 KB
testcase_40 AC 56 ms
78,592 KB
testcase_41 AC 58 ms
80,548 KB
testcase_42 AC 41 ms
61,440 KB
testcase_43 AC 43 ms
63,360 KB
testcase_44 AC 42 ms
62,080 KB
testcase_45 AC 42 ms
62,080 KB
testcase_46 AC 42 ms
60,800 KB
testcase_47 AC 43 ms
62,976 KB
testcase_48 AC 43 ms
61,184 KB
testcase_49 AC 41 ms
60,288 KB
testcase_50 AC 43 ms
62,208 KB
testcase_51 AC 42 ms
62,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsA = list(map(int,input().split()))
cntall = N*(N+1)//2
cnt = 0
for i in range(N):
    if lsA[i] == 1:
        cnt += 1
    else:
        cntall -= cnt*(cnt+1)//2
        cnt = 0
cntall -= cnt*(cnt+1)//2
print(cntall)
0