結果

問題 No.1765 While Shining
ユーザー 👑 rin204rin204
提出日時 2021-12-13 01:22:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 104,776 KB
最終ジャッジ日時 2023-09-28 20:10:18
合計ジャッジ時間 5,081 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,056 KB
testcase_01 AC 76 ms
71,224 KB
testcase_02 AC 78 ms
71,204 KB
testcase_03 AC 76 ms
71,060 KB
testcase_04 AC 77 ms
71,192 KB
testcase_05 AC 76 ms
70,948 KB
testcase_06 AC 75 ms
71,224 KB
testcase_07 AC 77 ms
71,192 KB
testcase_08 AC 77 ms
70,976 KB
testcase_09 AC 111 ms
92,928 KB
testcase_10 AC 122 ms
104,268 KB
testcase_11 AC 116 ms
98,136 KB
testcase_12 AC 119 ms
101,444 KB
testcase_13 AC 112 ms
98,216 KB
testcase_14 AC 125 ms
104,616 KB
testcase_15 AC 121 ms
104,588 KB
testcase_16 AC 121 ms
104,592 KB
testcase_17 AC 121 ms
104,588 KB
testcase_18 AC 121 ms
104,616 KB
testcase_19 AC 121 ms
104,776 KB
testcase_20 AC 120 ms
104,540 KB
testcase_21 AC 121 ms
104,468 KB
testcase_22 AC 121 ms
104,516 KB
testcase_23 AC 124 ms
104,620 KB
testcase_24 AC 119 ms
104,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
for i in range(1, n, 2):
    A[i] ^= 1
    
r = n - 2
ans = 0
for i in range(n - 2, -1, -1):
    if A[i] != A[i + 1]:
        r = i
    if i % 2 != A[i] % 2:
        ans += r - i + 1
print(ans)
0