結果

問題 No.365 ジェンガソート
ユーザー Twizz
提出日時 2017-02-28 02:31:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 23,292 KB
最終ジャッジ日時 2024-06-11 20:30:53
合計ジャッジ時間 4,438 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 4 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

def switch(list,x):
    y=list.pop(list.index(x))
    list.insert(0,y)
    return list

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

#print(list)

for i in range(N):
    #print(list[-1:],N-i)
    if list[-1:]==N-i:
        continue
    else:
        index=list.index(N-i)
        new_list=list[index+1:]
        for j in new_list:
            #print("new",new_list)
            list=switch(list,max(new_list))
            new_list.remove(max(new_list))
            cnt+=1
            #print(cnt,list)
        list.remove(N-i)
        #print(list)

print(cnt)
0