結果

問題 No.45 回転寿司
ユーザー 百
提出日時 2023-04-10 18:01:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2024-04-15 22:16:40
合計ジャッジ時間 16,982 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
V=list(map(int,input().split()))
score=0

v1=[0]+V+[0]
v2=[]

def get():#v1から0以外を探し、対応するv2が最大値ならそのインデックスを出力
    for i in range(1,N+1):
        if (v1[i]!=0)and(v2[i]==max(v2)):
            return i
    return 1

def remake():
    global v2
    v2=[0]+[v1[i]-v1[i-1]-v1[i+1] for i in range(1,N+1)]+[0]
remake()


count=0
while True:
    count+=1
    if count>=1500:
        print('over')
        break
    if len(set(v1))==1:
        break
    g=get()
    score+=v1[g]
    v1[g-1],v1[g],v1[g+1]=0,0,0
    remake()
    

print(score)
0