結果

問題 No.1298 OR XOR
ユーザー donutholedonuthole
提出日時 2020-11-27 22:00:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 935 bytes
コンパイル時間 903 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 95,528 KB
最終ジャッジ日時 2023-10-01 05:47:32
合計ジャッジ時間 6,131 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 262 ms
95,300 KB
testcase_01 AC 270 ms
95,276 KB
testcase_02 AC 266 ms
95,480 KB
testcase_03 AC 269 ms
95,528 KB
testcase_04 AC 260 ms
95,512 KB
testcase_05 AC 262 ms
95,432 KB
testcase_06 AC 263 ms
95,500 KB
testcase_07 AC 267 ms
95,512 KB
testcase_08 AC 264 ms
95,188 KB
testcase_09 AC 270 ms
95,320 KB
testcase_10 AC 266 ms
95,364 KB
testcase_11 AC 263 ms
95,360 KB
testcase_12 AC 264 ms
95,372 KB
testcase_13 AC 261 ms
95,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import decimal
import copy

# sys.setrecursionlimit(10000001)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353


def ni(): return int(sys.stdin.buffer.readline())
def ns(): return map(int, sys.stdin.buffer.readline().split())
def na(): return list(map(int, sys.stdin.buffer.readline().split()))
def na1(): return list(map(lambda x: int(x)-1, sys.stdin.buffer.readline().split()))


# ===CODE===

def main():
    n = ni()

    a, b, c = 0, 0, 0
    flg=False
    reverse = 1
    for i in range(31):
        if n >> i & 1:
            t = pow(2,i)
            if reverse:
                a += t
                b += t
            else:
                flg=True
                b+=t
                c+=t
            reverse^=1
    if flg:
        print(a, b, c)
    else:
        print(-1,-1,-1)


if __name__ == '__main__':
    main()
0