結果
問題 |
No.1871 divisXor
|
ユーザー |
![]() |
提出日時 | 2025-06-12 19:14:57 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,905 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 81,908 KB |
実行使用メモリ | 83,452 KB |
最終ジャッジ日時 | 2025-06-12 19:15:16 |
合計ジャッジ時間 | 4,111 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 28 |
ソースコード
def main(): import sys N = int(sys.stdin.readline()) if N == 0: print(-1) return # Check if the sample sequence works f1 = 1 f6 = 12 f12 = 28 xor = f1 ^ f6 ^ f12 if xor == N: sum_A = 1 + 6 + 12 if sum_A < 2 * N: print(3) print(1, 6, 12) return # If not, check other possibilities # For simplicity, we'll try to find a single number # whose sum of divisors is N found = False for x in range(1, 2 * N): s = 0 for i in range(1, int(x**0.5) + 1): if x % i == 0: s += i if i != x // i: s += x // i if s == N: if x < 2 * N: print(1) print(x) found = True break if found: return # Check for M=2 # We'll look for two numbers a and b such that f(a) XOR f(b) = N # This is a simplified approach and may not cover all cases max_a = min(2 * N // 2, 100000) for a in range(1, max_a + 1): fa = 0 for i in range(1, int(a**0.5) + 1): if a % i == 0: fa += i if i != a // i: fa += a // i for b in range(a + 1, 2 * N): fb = 0 for i in range(1, int(b**0.5) + 1): if b % i == 0: fb += i if i != b // i: fb += b // i if (fa ^ fb) == N: sum_ab = a + b if sum_ab < 2 * N: print(2) print(a, b) found = True break if found: break if found: return # If none of the above works, output -1 print(-1) if __name__ == "__main__": main()