結果
| 問題 |
No.1604 Swap Sort:ONE
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-07-16 21:34:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 208 bytes |
| コンパイル時間 | 166 ms |
| コンパイル使用メモリ | 82,372 KB |
| 実行使用メモリ | 64,084 KB |
| 最終ジャッジ日時 | 2024-07-06 08:32:02 |
| 合計ジャッジ時間 | 2,782 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
n = int(input())
*p, = map(lambda x: int(x)-1,input().split())
pos = [0]*n
for i,pi in enumerate(p):
pos[pi] = i
ans = 0
for i in range(n):
for j in range(i):
ans += pos[i] < pos[j]
print(ans)
convexineq