結果

問題 No.1298 OR XOR
ユーザー NoneNone
提出日時 2021-04-30 01:56:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 71,536 KB
最終ジャッジ日時 2023-09-25 01:43:31
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,464 KB
testcase_01 AC 71 ms
71,392 KB
testcase_02 AC 70 ms
71,168 KB
testcase_03 AC 74 ms
71,196 KB
testcase_04 AC 72 ms
71,004 KB
testcase_05 AC 73 ms
71,340 KB
testcase_06 AC 72 ms
71,396 KB
testcase_07 AC 71 ms
71,252 KB
testcase_08 AC 72 ms
71,536 KB
testcase_09 AC 72 ms
71,280 KB
testcase_10 AC 73 ms
71,344 KB
testcase_11 AC 71 ms
71,292 KB
testcase_12 AC 72 ms
71,100 KB
testcase_13 AC 71 ms
71,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def popcnt(n):
    """ n<=64 """
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

N=int(input())
if popcnt(N)==1:
    print(-1,-1,-1)
else:
    for i in range((N-1).bit_length()):
        if N&(1<<i):
            A=N&(1<<i)
            break
    B=N-A
    print(A,B,N)
0