結果

問題 No.1007 コイン集め
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-06 23:38:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,368 KB
実行使用メモリ 90,072 KB
最終ジャッジ日時 2024-04-22 10:42:07
合計ジャッジ時間 2,380 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,496 KB
testcase_01 AC 38 ms
53,176 KB
testcase_02 AC 43 ms
53,600 KB
testcase_03 AC 38 ms
52,764 KB
testcase_04 AC 38 ms
51,876 KB
testcase_05 AC 39 ms
52,112 KB
testcase_06 AC 38 ms
53,364 KB
testcase_07 AC 38 ms
53,108 KB
testcase_08 AC 40 ms
52,460 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 71 ms
87,148 KB
testcase_13 AC 72 ms
89,640 KB
testcase_14 AC 70 ms
88,916 KB
testcase_15 AC 68 ms
84,516 KB
testcase_16 AC 69 ms
83,404 KB
testcase_17 AC 85 ms
83,848 KB
testcase_18 AC 74 ms
89,744 KB
testcase_19 AC 66 ms
83,496 KB
testcase_20 WA -
testcase_21 AC 73 ms
90,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
A = list(map(int, input().split()))

if A[k-1] == 0 or A[k-1] == 1:
    print(A[k-1])
    exit()

A = [0] + A + [0]
#print(A)

for i in range(k):
    if A[i] == 0:
        p = i
        q = 0
    elif A[i] == 1:
        p = i
        q = 1

for i in reversed(range(k+1, n+2)):
    if A[i] == 0:
        r = i
        s = 0
    elif A[i] == 1:
        r = i
        s = 1

#print(p, q, r, s)
ans = sum(A[p:k])+A[k]+sum(A[k+1:r+1])
print(ans)
0