結果

問題 No.1007 コイン集め
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-06 23:37:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 91,184 KB
最終ジャッジ日時 2024-04-22 10:41:40
合計ジャッジ時間 2,422 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,676 KB
testcase_01 AC 40 ms
51,620 KB
testcase_02 AC 39 ms
52,612 KB
testcase_03 AC 39 ms
52,148 KB
testcase_04 AC 39 ms
52,340 KB
testcase_05 AC 39 ms
53,484 KB
testcase_06 AC 39 ms
53,068 KB
testcase_07 AC 38 ms
51,812 KB
testcase_08 AC 39 ms
52,324 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 70 ms
87,864 KB
testcase_13 AC 70 ms
88,912 KB
testcase_14 AC 70 ms
88,408 KB
testcase_15 AC 67 ms
84,320 KB
testcase_16 AC 67 ms
84,624 KB
testcase_17 AC 67 ms
84,964 KB
testcase_18 AC 70 ms
90,544 KB
testcase_19 AC 65 ms
83,348 KB
testcase_20 WA -
testcase_21 AC 72 ms
91,184 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