結果

問題 No.1765 While Shining
コンテスト
ユーザー notsix4
提出日時 2021-11-26 23:15:58
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 466 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 407 ms
コンパイル使用メモリ 20,568 KB
実行使用メモリ 27,848 KB
最終ジャッジ日時 2026-03-19 08:36:01
合計ジャッジ時間 8,696 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
l=list(map(int,input().split()))
c=0
nl=[]
for i in l:
    if i==1:
        nl.append(0)
    else:
        nl.append(1)
ml=l
d=0
K=[]
for i in range(n):
    if l[i]==1:
        K.append(i)
for j in K:
    for i in range(n-1):
        if l[j+i]==1 and j+i<n-1:
            c+=1
            if c%2==1:
                l=nl
            else:
                l=ml
        else:
            d+=c
            c=0
            l=ml
            break
print(d)
0