結果
問題 |
No.1881 Everything is the same...
|
ユーザー |
![]() |
提出日時 | 2025-04-15 22:52:12 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,484 bytes |
コンパイル時間 | 348 ms |
コンパイル使用メモリ | 81,516 KB |
実行使用メモリ | 78,444 KB |
最終ジャッジ日時 | 2025-04-15 22:54:39 |
合計ジャッジ時間 | 6,981 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 42 |
ソースコード
import sys from collections import defaultdict def factorize(n): factors = defaultdict(int) if n == 0: return factors while n % 2 == 0: factors[2] += 1 n = n // 2 i = 3 while i * i <= n: while n % i == 0: factors[i] += 1 n = n // i i += 2 if n > 1: factors[n] += 1 return factors def main(): input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 A_list = list(map(int, input[idx:idx+N])) nimbers = [] for A in A_list: if A == 0: nimbers.append(0) continue factors = factorize(A) count = defaultdict(int) for p, e in factors.items(): if p == 2: if e == 1: continue elif e == 2: count[2] += 1 else: count[2] += 2 else: m = (p - 1) * (p ** (e - 1)) m_factors = factorize(m) for q in m_factors: count[q] += 1 if not count: nimbers.append(0) else: nimbers.append(max(count.values())) xor_sum = 0 for n in nimbers: xor_sum ^= n if all(n == 0 for n in nimbers): print("X") else: if xor_sum != 0: print("X") else: print("Y") if __name__ == "__main__": main()