結果

問題 No.1007 コイン集め
ユーザー komkompikomkompi
提出日時 2020-04-04 12:18:51
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 19,028 KB
最終ジャッジ日時 2023-09-16 05:34:58
合計ジャッジ時間 1,934 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,944 KB
testcase_01 AC 16 ms
7,836 KB
testcase_02 AC 15 ms
7,824 KB
testcase_03 AC 16 ms
7,752 KB
testcase_04 AC 15 ms
7,816 KB
testcase_05 AC 14 ms
7,800 KB
testcase_06 AC 15 ms
7,776 KB
testcase_07 AC 15 ms
7,800 KB
testcase_08 AC 16 ms
7,944 KB
testcase_09 AC 15 ms
7,964 KB
testcase_10 AC 15 ms
7,960 KB
testcase_11 AC 16 ms
7,832 KB
testcase_12 AC 58 ms
18,916 KB
testcase_13 AC 57 ms
18,936 KB
testcase_14 AC 59 ms
18,964 KB
testcase_15 WA -
testcase_16 AC 37 ms
10,860 KB
testcase_17 AC 37 ms
10,848 KB
testcase_18 AC 59 ms
19,028 KB
testcase_19 AC 57 ms
18,888 KB
testcase_20 AC 57 ms
18,864 KB
testcase_21 AC 53 ms
18,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N,K=map(int,input().split())

def kill(lis):
    lis_index=len(lis)
    for i in range(len(lis)):
        if lis[i]==0:
            lis_index==i
            break
        elif lis[i]==1:
            lis_index=i
            break

    return lis[:lis_index+1]

A=[0]+list(map(int,input().split()))+[0]


L=A[:K]
#print(len(L))
#print(len(kill(L[::-1])))

R=A[K+1:]
#print(len(R))
#print(len(kill(R)))

score=[sum(kill(L[::-1])),sum(kill(R))]

if A[K]>=2:
    print(sum(score)+A[K])
elif A[K]==1:
    print(max(score)+A[K])
else:
    print(0)
0