結果

問題 No.1505 Zero-Product Ranges
ユーザー gorugo30gorugo30
提出日時 2021-05-14 22:07:43
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 1,079 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 104,548 KB
最終ジャッジ日時 2023-07-25 06:50:20
合計ジャッジ時間 7,554 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,196 KB
testcase_01 AC 77 ms
71,252 KB
testcase_02 AC 75 ms
71,424 KB
testcase_03 AC 117 ms
103,940 KB
testcase_04 AC 115 ms
104,012 KB
testcase_05 AC 94 ms
85,964 KB
testcase_06 AC 93 ms
86,016 KB
testcase_07 AC 90 ms
83,152 KB
testcase_08 AC 94 ms
84,364 KB
testcase_09 AC 88 ms
83,212 KB
testcase_10 AC 91 ms
84,108 KB
testcase_11 AC 92 ms
85,676 KB
testcase_12 AC 89 ms
81,956 KB
testcase_13 AC 100 ms
92,860 KB
testcase_14 AC 96 ms
90,784 KB
testcase_15 AC 113 ms
103,908 KB
testcase_16 AC 119 ms
104,372 KB
testcase_17 AC 117 ms
104,256 KB
testcase_18 AC 118 ms
104,548 KB
testcase_19 AC 76 ms
71,092 KB
testcase_20 AC 77 ms
71,164 KB
testcase_21 AC 77 ms
71,396 KB
testcase_22 AC 116 ms
104,040 KB
testcase_23 AC 117 ms
104,216 KB
testcase_24 AC 116 ms
104,312 KB
testcase_25 AC 113 ms
100,836 KB
testcase_26 AC 115 ms
104,392 KB
testcase_27 AC 113 ms
100,892 KB
testcase_28 AC 114 ms
100,932 KB
testcase_29 AC 116 ms
104,244 KB
testcase_30 AC 116 ms
104,312 KB
testcase_31 AC 115 ms
104,064 KB
testcase_32 AC 98 ms
89,076 KB
testcase_33 AC 98 ms
88,752 KB
testcase_34 AC 100 ms
90,712 KB
testcase_35 AC 94 ms
85,996 KB
testcase_36 AC 97 ms
87,384 KB
testcase_37 AC 98 ms
89,192 KB
testcase_38 AC 97 ms
88,560 KB
testcase_39 AC 100 ms
88,944 KB
testcase_40 AC 99 ms
89,096 KB
testcase_41 AC 102 ms
90,736 KB
testcase_42 AC 83 ms
75,980 KB
testcase_43 AC 85 ms
76,716 KB
testcase_44 AC 83 ms
76,144 KB
testcase_45 AC 82 ms
76,444 KB
testcase_46 AC 81 ms
76,484 KB
testcase_47 AC 83 ms
76,748 KB
testcase_48 AC 83 ms
76,432 KB
testcase_49 AC 83 ms
76,180 KB
testcase_50 AC 85 ms
76,220 KB
testcase_51 AC 82 ms
76,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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