結果

問題 No.1298 OR XOR
ユーザー ayaoniayaoni
提出日時 2020-11-27 23:35:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 71,672 KB
最終ジャッジ日時 2023-10-10 21:48:00
合計ジャッジ時間 2,388 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,364 KB
testcase_01 AC 74 ms
71,420 KB
testcase_02 AC 73 ms
71,592 KB
testcase_03 AC 72 ms
71,656 KB
testcase_04 AC 72 ms
71,672 KB
testcase_05 AC 72 ms
71,512 KB
testcase_06 AC 72 ms
71,400 KB
testcase_07 AC 72 ms
71,420 KB
testcase_08 AC 72 ms
71,556 KB
testcase_09 AC 71 ms
71,172 KB
testcase_10 AC 74 ms
71,368 KB
testcase_11 AC 71 ms
71,420 KB
testcase_12 AC 73 ms
71,484 KB
testcase_13 AC 73 ms
71,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())


N = I()


def popcount(n):
    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


X = popcount(N)
if X == 1:
    print(-1,-1,-1)
else:
    A = N & (-N)
    B = N
    C = A ^ B
    print(A,B,C)
0