結果

問題 No.2089 置換の符号
コンテスト
ユーザー norioc
提出日時 2026-01-26 02:42:03
言語 PyPy3
(7.3.17)
結果
WA  
実行時間 -
コード長 244 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 360 ms
コンパイル使用メモリ 82,508 KB
実行使用メモリ 63,968 KB
最終ジャッジ日時 2026-01-26 02:42:06
合計ジャッジ時間 3,202 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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
    x = xs[i]
    xs[i], xs[x] = xs[x], xs[i]
    cnt += 1

if cnt % 2 == 0:
    print(1)
else:
    print(-1)
0