結果
| 問題 |
No.1604 Swap Sort:ONE
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-16 22:48:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 337 bytes |
| コンパイル時間 | 269 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 81,280 KB |
| 最終ジャッジ日時 | 2024-07-06 10:19:43 |
| 合計ジャッジ時間 | 4,158 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 TLE * 1 -- * 20 |
ソースコード
N = int(input())
P = list(map(int,input().split()))
cnt = 0
Q = [0 for _ in range(N+1)]
for index,p in enumerate(P):
Q[p] = index
flag = True
while flag:
flag = False
for i in range(1,N):
if Q[i] > Q[i+1]:
Q[i],Q[i+1] = Q[i+1],Q[i]
flag = True
cnt += 1
break
print(cnt)