結果
| 問題 |
No.370 道路の掃除
|
| コンテスト | |
| ユーザー |
rocoder
|
| 提出日時 | 2017-07-26 12:45:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 615 bytes |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-10-09 17:43:49 |
| 合計ジャッジ時間 | 2,279 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 30 |
ソースコード
#clean
N,M=(int(i) for i in input().split())
s=0
D=[]
nd=0
for i in range(M):
D.append(int(input()))
if D[i]>0 and nd==0:
s=i
nd=1
i=0
mi=0
if s+N-1 <len(D):
mi=D[s+N-1]
r=0
pl=D[s+N-1]
mp=s+N
# print (s)
else:
r=s+N-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