結果
| 問題 | No.2089 置換の符号 |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-01-26 02:44:23 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 316 bytes |
| 記録 | |
| コンパイル時間 | 422 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 64,608 KB |
| 最終ジャッジ日時 | 2026-01-26 02:44:27 |
| 合計ジャッジ時間 | 3,165 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
N = int(input())
S = list(map(lambda x: int(x)-1, input().split()))
xs = S[:]
cnt = 0
for i in range(N):
if xs[i] == i: continue
for j in range(i+1, N):
if xs[j] == i:
xs[i], xs[j] = xs[j], xs[i]
cnt += 1
break
if cnt % 2 == 0:
print(1)
else:
print(-1)
norioc