結果

問題 No.1765 While Shining
ユーザー notsix4notsix4
提出日時 2021-11-26 23:15:58
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 466 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 20,068 KB
最終ジャッジ日時 2023-09-12 05:33:50
合計ジャッジ時間 8,014 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
12,304 KB
testcase_01 AC 14 ms
7,852 KB
testcase_02 AC 14 ms
7,800 KB
testcase_03 AC 14 ms
7,948 KB
testcase_04 AC 14 ms
7,912 KB
testcase_05 AC 14 ms
7,912 KB
testcase_06 AC 14 ms
7,804 KB
testcase_07 AC 14 ms
7,728 KB
testcase_08 AC 15 ms
7,832 KB
testcase_09 AC 159 ms
12,796 KB
testcase_10 AC 225 ms
14,800 KB
testcase_11 AC 203 ms
14,032 KB
testcase_12 AC 217 ms
14,300 KB
testcase_13 AC 199 ms
13,956 KB
testcase_14 AC 242 ms
15,408 KB
testcase_15 AC 238 ms
15,364 KB
testcase_16 AC 240 ms
15,316 KB
testcase_17 AC 241 ms
15,360 KB
testcase_18 AC 236 ms
15,472 KB
testcase_19 AC 244 ms
15,408 KB
testcase_20 AC 242 ms
15,488 KB
testcase_21 AC 239 ms
15,484 KB
testcase_22 AC 253 ms
15,460 KB
testcase_23 AC 240 ms
15,396 KB
testcase_24 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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