結果
| 問題 | No.1298 OR XOR | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-11-28 14:34:30 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 1,039 bytes | 
| コンパイル時間 | 1,568 ms | 
| コンパイル使用メモリ | 166,568 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-12 22:27:30 | 
| 合計ジャッジ時間 | 2,349 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 13 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SIZE(x) ll(x.size())
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    int t = N;
    int cnt = 0;
    while (t) {
        if (t & 1) cnt++;
        t = t >> 1;
    }
    if (cnt <= 1) {
        cout << "-1 -1 -1" << endl;
        return 0;
    }
    int a, b = 0, c = 0;
    a = N;
    int ct = 1;
    while (ct <= N) {
        if (N & ct) {
            if (b == 0) {
                b = ct;
            }
            else {
                c += ct;
            }
        }
        ct <<= 1;
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}
            
            
            
        