結果
| 問題 |
No.397 NO MORE KADOMATSU
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 16:44:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 434 bytes |
| コンパイル時間 | 391 ms |
| コンパイル使用メモリ | 81,604 KB |
| 実行使用メモリ | 77,204 KB |
| 最終ジャッジ日時 | 2025-04-16 16:46:34 |
| 合計ジャッジ時間 | 6,944 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 17 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
dummy = input()
target = sorted(a, reverse=True)
current = a.copy()
swaps = []
for i in range(n):
# Find the index j >= i where current[j] == target[i]
j = i
while j < n and current[j] != target[i]:
j += 1
if j != i:
swaps.append((i, j))
current[i], current[j] = current[j], current[i]
print(len(swaps))
for u, v in swaps:
print(u, v)
lam6er