結果
| 問題 |
No.397 NO MORE KADOMATSU
|
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 15:31:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 620 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 81,924 KB |
| 実行使用メモリ | 86,796 KB |
| 最終ジャッジ日時 | 2025-06-12 15:32:44 |
| 合計ジャッジ時間 | 6,706 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 17 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
dummy = int(input()) # This line is just for handling the dummy input
# Create the target array sorted in decreasing order
target = sorted(a, reverse=True)
current = a.copy()
swaps = []
for i in range(n):
if current[i] == target[i]:
continue
# Find the position j where current[j] is target[i]
for j in range(i, n):
if current[j] == target[i]:
break
# Perform the swap
current[i], current[j] = current[j], current[i]
swaps.append((i, j))
# Output the result
print(len(swaps))
for u, v in swaps:
print(u, v)
gew1fw