結果
問題 | No.1298 OR XOR |
ユーザー |
|
提出日時 | 2022-05-14 20:51:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 886 bytes |
コンパイル時間 | 3,862 ms |
コンパイル使用メモリ | 229,516 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 07:52:01 |
合計ジャッジ時間 | 4,633 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;//#define DISABLE_PRINT#if defined(ENABLE_PRINT) && !defined(DISABLE_PRINT)#define P(...) fprintf(stderr, __VA_ARGS__)#define P2(fmt) fprintf(stderr, fmt)#define LP fprintf(stderr, "L: %d\n", __LINE__)#else#define P(...) ((void)0)#define P2(fmt) ((void)0)#define LP ((void)0)#endif#define rep(i, n) for(int i = 0; i < (int)(n); ++i)#define ALL(x) x.begin(),x.end()using ll = long long;using ull = unsigned long long;int main(int, const char**){int N; cin >> N;int A = 0, B = 0;rep(i, 30) {if(((N >> i) & 1) == 1) {if(A == 0) {A = (1 << i);}else B |= (1 << i);}}if(A == 0 || B == 0) {printf("-1 -1 -1\n");return 0;}printf("%d %d %d\n", A, B, A ^ B);return 0;}