結果

問題 No.1765 While Shining
ユーザー cozy_saunacozy_sauna
提出日時 2022-03-10 17:35:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 106,288 KB
最終ジャッジ日時 2023-10-12 19:58:23
合計ジャッジ時間 4,224 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,264 KB
testcase_01 AC 74 ms
71,292 KB
testcase_02 AC 76 ms
71,268 KB
testcase_03 AC 78 ms
71,340 KB
testcase_04 AC 74 ms
71,176 KB
testcase_05 AC 74 ms
71,292 KB
testcase_06 AC 77 ms
71,040 KB
testcase_07 AC 74 ms
71,332 KB
testcase_08 AC 74 ms
71,332 KB
testcase_09 AC 97 ms
93,996 KB
testcase_10 AC 109 ms
105,712 KB
testcase_11 AC 104 ms
99,324 KB
testcase_12 AC 106 ms
102,376 KB
testcase_13 AC 103 ms
99,568 KB
testcase_14 AC 110 ms
106,028 KB
testcase_15 AC 109 ms
106,060 KB
testcase_16 AC 111 ms
106,096 KB
testcase_17 AC 112 ms
106,288 KB
testcase_18 AC 112 ms
105,868 KB
testcase_19 AC 113 ms
105,892 KB
testcase_20 AC 110 ms
106,232 KB
testcase_21 AC 111 ms
105,964 KB
testcase_22 AC 111 ms
105,920 KB
testcase_23 AC 110 ms
106,224 KB
testcase_24 AC 108 ms
105,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
M = [0] * 2
m, n = 0, 0
ans = 0
i = N - 1
for a in A[::-1]:
    ans += m * a * (i != N - 1)
    m, n = n * (1 - a) + 1, m * a + 1
    # if a: m = 1
    # else: n = 1
    i -= 1
    
print(ans)
0