結果
問題 |
No.45 回転寿司
|
ユーザー |
|
提出日時 | 2023-04-10 18:01:20 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 605 bytes |
コンパイル時間 | 126 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,248 KB |
最終ジャッジ日時 | 2024-10-06 04:14:40 |
合計ジャッジ時間 | 17,085 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | WA * 2 TLE * 1 -- * 27 |
ソースコード
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)