結果

問題 No.365 ジェンガソート
ユーザー Schumi543
提出日時 2016-05-17 15:07:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 255 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,464 KB
最終ジャッジ日時 2024-10-06 05:13:30
合計ジャッジ時間 6,381 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 RE * 34 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(map(int, input().split()))

c = 0
for i in reversed(range(n)):
    if s.index(i+1) == i :
        s.remove(i+1)
    else:
        c += len(s)-s.index(i+1)-1
        s1 = s*2
        s = s1[s.index(i+1)+1: i-1+s.index(i)]
print(c)
0