結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,000 KB
testcase_01 AC 70 ms
71,404 KB
testcase_02 AC 69 ms
71,412 KB
testcase_03 AC 69 ms
71,160 KB
testcase_04 AC 70 ms
71,548 KB
testcase_05 AC 70 ms
71,260 KB
testcase_06 AC 73 ms
71,336 KB
testcase_07 AC 71 ms
71,052 KB
testcase_08 AC 71 ms
71,444 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 103 ms
93,724 KB
testcase_13 AC 98 ms
93,804 KB
testcase_14 AC 97 ms
93,800 KB
testcase_15 AC 87 ms
90,640 KB
testcase_16 AC 90 ms
90,796 KB
testcase_17 AC 90 ms
90,864 KB
testcase_18 AC 98 ms
94,196 KB
testcase_19 AC 96 ms
93,580 KB
testcase_20 WA -
testcase_21 AC 97 ms
93,996 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