結果
| 問題 | 
                            No.370 道路の掃除
                             | 
                    
| コンテスト | |
| ユーザー | 
                             rocoder
                         | 
                    
| 提出日時 | 2017-07-26 12:29:28 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 576 bytes | 
| コンパイル時間 | 96 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-10-09 17:43:44 | 
| 合計ジャッジ時間 | 2,031 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | RE * 34 | 
ソースコード
#clean
N,M=(int(i) for i in input().split())
s=0
for i in range(N):
    D.append(int(input()))
    if D[i]>0 and s==0:
        s=i
i=0
mi=0
if s+M-1 <len(D):
    mi=D[s+M-1]
    r=0
    pl=D[s+M-1]
    mp=s+M
else:
    r=s+M-len(D)+1
    if s-r>=0:
        mp=len(D)-1
        pl=D[-1]
        nus=D[s-r]*-1
        if nus<pl:
            db=nus
        else:
            db=pl
        mi=pl+nus+db
r+=1
while s-r>=0:
    nus=-1*D[s-r]
    mp-=1
    pl=D[mp]
    if nus<pl:
        db=nus
    else:
        db=pl
    m1=pl+nus+db
    if m1<mi:
        mi=m1
    r+=1
print(mi)
            
            
            
        
            
rocoder