結果

問題 No.1007 コイン集め
ユーザー syunsukesyunsuke
提出日時 2020-09-14 23:13:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 94,048 KB
最終ジャッジ日時 2023-09-04 00:51:43
合計ジャッジ時間 4,141 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,344 KB
testcase_01 AC 75 ms
71,416 KB
testcase_02 AC 80 ms
71,320 KB
testcase_03 AC 74 ms
71,160 KB
testcase_04 AC 73 ms
71,448 KB
testcase_05 AC 76 ms
71,264 KB
testcase_06 AC 75 ms
71,192 KB
testcase_07 AC 75 ms
71,252 KB
testcase_08 AC 76 ms
71,252 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 RE -
testcase_13 WA -
testcase_14 RE -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 101 ms
93,944 KB
testcase_19 AC 98 ms
93,572 KB
testcase_20 WA -
testcase_21 AC 100 ms
94,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
L=[0]+list(map(int,input().split()))+[0]

if L[K]==0:
    print(0)
    exit()
else:
    right=0
    for r in range(K,10**9):
        if L[r]>1:
            right+=L[r]
        if L[r]==1:
            right+=1
            break
        if L[r]==0:
            break
    left=0
    for l in range(10**9):
        if L[K-l]>1:
            left+=L[K+l]
        if L[K-l]==1:
            left+=1
            break
        if L[K-l]==0:
            break
    if L[K]==1:
        print(max(left,right))
    else:
        print(left+right-L[K])
        #print(left,right)
    
0