結果
| 問題 |
No.1871 divisXor
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 19:10:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,835 bytes |
| コンパイル時間 | 203 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 58,112 KB |
| 最終ジャッジ日時 | 2025-06-12 19:10:47 |
| 合計ジャッジ時間 | 8,372 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 26 |
ソースコード
def f(x):
if x == 0:
return 0
sum = 0
i = 1
while i * i <= x:
if x % i == 0:
if i * i == x:
sum += i
else:
sum += i
sum += x // i
i += 1
return sum
N = int(input())
if N == 0:
print(-1)
else:
found = False
# Check if M=1 is possible
for x in [N]:
if f(x) == N and x < 2 * N:
print(1)
print(x)
found = True
break
if not found:
# Check if K can be represented as 12 XOR 28 = 16
K = N ^ 1
if K == 16:
print(3)
print(1, 6, 12)
found = True
if not found:
# Try to find other a and b
# For example, a=6, f(a)=12
a = 6
fa = f(a)
target = K ^ fa
b = None
for x in [target - 1, target + 1, target * 2 - 1]:
if x > 0:
if f(x) == target:
b = x
break
if b is not None and b != a and b != 1:
sum_total = 1 + a + b
if sum_total < 2 * N:
print(3)
print(1, a, b)
found = True
if not found:
# Another attempt with a=3, f(a)=4
a = 3
fa = f(a)
target = K ^ fa
b = None
for x in [target - 1, target + 1, target * 2 - 1]:
if x > 0:
if f(x) == target:
b = x
break
if b is not None and b != a and b != 1:
sum_total = 1 + a + b
if sum_total < 2 * N:
print(3)
print(1, a, b)
found = True
if not found:
print(-1)
gew1fw