結果
問題 | No.2089 置換の符号 |
ユーザー | titan23 |
提出日時 | 2022-09-30 21:40:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 760 bytes |
コンパイル時間 | 543 ms |
コンパイル使用メモリ | 86,696 KB |
実行使用メモリ | 78,288 KB |
最終ジャッジ日時 | 2023-08-24 15:04:20 |
合計ジャッジ時間 | 6,251 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 112 ms
73,152 KB |
testcase_01 | AC | 113 ms
73,088 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 111 ms
72,904 KB |
testcase_09 | AC | 111 ms
72,932 KB |
testcase_10 | AC | 110 ms
73,052 KB |
testcase_11 | AC | 109 ms
72,908 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 109 ms
72,936 KB |
testcase_17 | AC | 117 ms
72,900 KB |
testcase_18 | AC | 118 ms
72,916 KB |
testcase_19 | AC | 117 ms
72,908 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 114 ms
73,280 KB |
testcase_23 | WA | - |
testcase_24 | AC | 112 ms
72,756 KB |
testcase_25 | WA | - |
testcase_26 | AC | 111 ms
73,080 KB |
testcase_27 | WA | - |
testcase_28 | AC | 159 ms
78,252 KB |
testcase_29 | AC | 186 ms
78,204 KB |
testcase_30 | AC | 189 ms
78,288 KB |
testcase_31 | AC | 190 ms
78,124 KB |
testcase_32 | AC | 181 ms
78,120 KB |
ソースコード
'''input ''' import sys import math from bisect import bisect_right, bisect_left from itertools import * from collections import * from heapq import heapify, heappush, heappop import random inf = float('inf') # mod = 1000000007 # mod = 998244353 input = lambda: sys.stdin.readline().rstrip() def error(*args, sep=' ', end='\n'): print(*args, sep=sep, end=end, file=sys.stderr) # sys.setrecursionlimit(10**6) # ----------------------- # n = int(input()) S = list(map(int, input().split())) for i in range(n): S[i] -= 1 seen = [False] * n cnt = 0 for i in range(n): if seen[i]: continue seen[i] = True f = i while True: i = S.index(i) seen[i] = True if i == f: break cnt += 1 sgn = 1 if cnt % 2 == 0 else -1 print(sgn)